text stringlengths 10 2.61M |
|---|
class StorySerializer < MessageSerializer
attributes :snapchat_media_id, :latitude, :longitude, :source, :permission, :has_face,
:status, :blurred, :shareable_to, :youtube_id
def latitude
latitude = object.latitude
return if latitude.blank?
if owner?
latitude.to_f
else
latitude.to_... |
class ClassMappingsController < ApplicationController
before_action :set_class_mapping, only: [:show, :edit, :update, :destroy]
# GET /class_mappings
# GET /class_mappings.json
def index
s_id = Allotment.where(user_id: current_user.id).pluck(:school_id)
@class_mappings = ClassMapping.includes(:standard... |
ActionController::Base.class_eval do
def self.require_user(options = {})
raise Exception, "require_user cannot be called on ActionController::Base. Only it's subclasses" if self == ActionController::Base
prepend_before_filter :require_user, options
end
helper_method :current_user, :current_user?
... |
# frozen_string_literal: true
SATISFACTION_FORM_DATA = {
satisfaction: 'PART',
person_delivering: {
name: 'Mr A Person',
address: {
premise: '1', street: 'Some Street', thourough_fare: 'Some Village',
post_town: 'Some Town', county: 'Some County', country: 'GBR', post_code: 'AB12 3CD',
ca... |
require 'test_helper'
class LeadsSignupTest < ActionDispatch::IntegrationTest
test "invalid signup information (does not create lead)" do
get '/sign_up'
assert_no_difference 'Lead.count' do
post '/', params: {lead: {
first_name: "",
last_name: "",
phone_number: "",
birt... |
class SearchService
def initialize(zip)
@zip = zip
@conn = Faraday.new(url: "https://developer.nrel.gov") do |faraday|
faraday.adapter Faraday.default_adapter
end
end
def make_stations
parse_results.map do |result|
Station.new(result)
end
end
def parse_results
JSON.parse... |
class Admin::VetContactsController < Admin::ApplicationController
load_and_authorize_resource
respond_to :html, :xml, :json, :xls
# GET /vet_contacts
# GET /vet_contacts.xml
def index
@search = VetContact.organization(current_user).search(params[:q])
@vet_contacts = @search.result.paginate(:page... |
class CreateUsedUrls < ActiveRecord::Migration[6.1]
def change
create_table :used_urls, id: false do |t|
t.string :short_name
t.string :long_name
t.datetime :last_used
t.timestamps
end
add_index :used_urls, :short_name, unique: true
add_index :used_urls, :last_used
end
end
|
# frozen_string_literal: true
class ApplicationController
def initialize(routes)
@routes = routes
@params = parse_params
@permitted_params = {}
@missing_fields = []
end
def set_params
yield
end
def present(options = {})
@routes.status(options[:status] || 200)
options[:payload]
... |
require "spec_helper"
describe RuntimeValidationsController do
describe "routing" do
it "routes to #index" do
get("/runtime_validations").should route_to("runtime_validations#index")
end
it "routes to #new" do
get("/runtime_validations/new").should route_to("runtime_validations#new")
en... |
require 'rails_helper'
describe Item do
before do
@item = FactoryBot.build(:item)
end
describe '商品の新規登録' do
context '新規登録がうまくいくとき' do
it "title,concept,category_id,status_id,delivery_id,area_id,days_id,price,が存在すれば登録できる" do
expect(@item).to be_valid
end
end
context '新規登録がうまくい... |
require 'rails_helper'
RSpec.describe "record_types/new", type: :view do
before(:each) do
assign(:record_type, create(:record_type))
end
it "renders new record_type form" do
render
assert_select "form[action=?][method=?]", record_types_path, "post" do
assert_select "input#record_type_name[na... |
# frozen_string_literal: true
module RbLint
module Rules
# Detects assigning values inside of conditions. For example:
#
# bar if foo = 1
#
module AssignmentInCondition
%i[case elsif if unless until while].each do |event|
define_method(:"on_#{event}") do |predicate, *others|
... |
class SessionController < ApplicationController
def new; end
def create
user = User.find_by(email: params[:email])
if user.nil?
flash[:error] = 'The provided email is not associated with an account. Please register or try again.'
redirect_to login_path
elsif user.authenticate(params[:passwo... |
require "test_helper"
describe "Markov::DB" do
before do
@dbname = "markov_test"
@source = "test/fixtures/text_sample.txt"
@parser = Markov::Parser.new(@source)
@db = Markov::DB.new(dbname: @dbname)
end
it "connects to the db" do
assert @db.send(:connection, "")
end
it "makes the word ... |
# coding: utf-8
class Admin::TicketsController < Admin::ApplicationController
before_filter :setup_default_filter, only: :index
def index
@search = Ticket.search(params[:q])
search_result = @search.result(distinct: true).order("id DESC, updated_at DESC")
@tickets = show_all? ? search_result : search_re... |
require "spec_helper"
module GotFixed
describe IssuesController do
routes { GotFixed::Engine.routes }
describe "routing" do
it "routes to #index" do
get("/issues").should route_to("got_fixed/issues#index")
end
end
end
end
|
# Included in +ApplicationHelper+, this sets up the override logic for
# cobrand-specific assets. Assuming the <tt>@cobrand</tt> instance variable is
# set and the asset exists in the current cobrand's (or cobrand's parent's or
# grandparent's) public directory, it will render. Under <tt>Rails.root</tt>:
#
# cob... |
class CreateReservations < ActiveRecord::Migration[6.1]
def change
create_table :reservations do |t|
t.references :user
t.references :screening
t.references :cinema
t.references :movie
t.boolean :confirmed, default: false
t.timestamps
end
end
end
|
require 'spec_helper'
feature 'visit password edit screen' do
scenario 'with valid token in url, redirects to the edit page with the token removed from the url' do
user = create(:user, :with_password_reset_token_and_timestamp)
visit_password_reset_page_for(user)
expect(current_path).to eq edit_users_pa... |
# frozen_string_literal: true
module Api
module V1
# API for authorization
class AuthController < BaseController
# POST /api/v1/sign_in
def sign_in
user = users_collection.authenticate(params[:email], params[:password])
render_response("Invalid email or password", 401) && return ... |
class Port < BaseResource
schema do
string :host_interface
integer :host_port
integer :container_port
string :proto
end
end
|
# == Schema Information
#
# Table name: tenants
#
# id :integer not null, primary key
# nome :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# subdomain :string(255)
#
require 'spec_helper'
describe Tenant do
let (:tenant) { FactoryGirl.cre... |
# coding: UTF-8
require 'sinatra'
require 'sinatra/streaming'
require 'zip/filesystem'
require 'aws-sdk'
require 'securerandom'
require './group'
DEFAULT_BUCKET = ENV['DEFAULT_BUCKET']
DEFAULT_ACCOUNT = ENV['DEFAULT_ACCOUNT']
DEFAULT_MONTH = Date.today.strftime('%Y-%m')
get '/' do
'<html><body><form action="downlo... |
class Brain
WINNING_COMBOS = [
[1, 2, 3], [4, 5, 6], [7, 8, 9],
[1, 4, 7], [2, 5, 8], [3, 6, 9],
[1, 5, 9], [3, 5, 7]
].freeze
def initialize
end
private
def invert(list)
(1..9).to_a.select { |num| !list.include?(num) }
end
def filter_wins(num)
WINNING_COMBOS.select do |combo|
... |
class CreateMedias < ActiveRecord::Migration
def change
create_table :medias do |t|
t.belongs_to :user
t.belongs_to :account, index: true
t.string :url
if ActiveRecord::Base.connection.class.name === 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter'
t.json :data
else
... |
#
# Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands.
#
# This file is part of New Women Writers.
#
# New Women Writers is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundat... |
class AcceptedOffersController < ApplicationController
def create
@offer = Offer.find(params[:offer_id])
@accepted_offer = AcceptedOffer.new
@accepted_offer.offer = @offer
@accepted_offer.user = current_user
authorize @accepted_offer
if @accepted_offer.save
redirect_to offer_path(@offer)... |
class GeoRoundRobin
#for further purposes
@@current_cycle = nil
def self.companies_for_slots(companies, slots=nil)
# Podria validar que los datos dentro de companies sea de la clase correspondiente pero seria limitar la funcionalidad.
raise "companies should be an Array of Companies" unless companies.cla... |
require 'board'
describe 'Board' do
let(:b){Board.new}
describe '#initialize' do
it 'should create a bomb grid' do
expect(b.bomb_grid).to be_a(Array)
end
it 'should create flag-activate grid' do
expect(b.bomb_grid).to be_a(Array)
end
end
describe '#populate' do
it 'popul... |
module NavigationHelpers
def path_for(page_description)
case page_description
when "home" then root_path
else raise "unrecognized page description \"#{page_description}\"."
end
end
def locator_for(location_description)
case location_description
when "menu" then "#menu"
when "navigatio... |
class Carriage
include Manufacturer
include Validation
attr_reader :capacity, :occupied
validate :manufacturer, :presence
def initialize(manufacturer, capacity)
@manufacturer = manufacturer
@capacity = capacity
validate!
@occupied = 0
end
def free_capacity
capacity ... |
class Admin::UsersController < ApplicationController
layout 'admin'
before_action :authenticate_user!
before_action :set_users, only: [:edit, :update, :destroy]
load_and_authorize_resource
def index
@users = User.all
end
def new
@user = User.new
@user.build_agent_detail
end
def create
... |
class AriaquenuploadsController < ApplicationController
# GET /ariaquenuploads
# GET /ariaquenuploads.json
def index
@ariaquenuploads = Ariaquenupload.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @ariaquenuploads }
end
end
# GET /ariaquenuploads/... |
class Profile < ActiveRecord::Base
enum gender: { male: 'M', female: 'F'}
has_one :casa
belongs_to :screen_writer
mount_uploader :profile_pic, ProfilePicUploader # Tells rails to use this uploader for this model.
validates :fname,:dob,:gender, :presence => true
has_one :address, -> { where entity_type: :scr... |
class Attribute < ActiveRecord::Base
has_many :children, :foreign_key => :parent_id, :class_name => 'Attribute', :order => '`attributes`.`order`, `attributes`.`value` '
belongs_to :parent, :foreign_key => :parent_id, :class_name => 'Attribute'
has_and_belongs_to_many :events, :class_name => "Event" , :join_table... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
RELEASE="3.6.3"
BUILD="1"
# Synced folders, if any, are stored here
synced_folders=Hash.new
# Extract SYNCED_FOLDERS into a hash for use below
if ENV['SYNCED_FOLDERS... |
# == Schema Information
#
# Table name: visits
#
# id :integer not null, primary key
# visit_nr :integer
# visit_date :datetime
# league :string(255)
# home_club :string(255)
# away_club :string(255)
# ground :string(255)
# street :string(255)
# city :string(255)
# count... |
class PostEvent < ApplicationRecord
validates :title, presence: true
validates :title, length: { maximum: 40 }
validates :description, length: { maximum: 300 }
validates :category, inclusion: { in: %w[defect supply others], message: 'Category need to be choosen' }
validates :importance, inclusion: { in: %w[im... |
class ChangeFundAmountDefault < ActiveRecord::Migration
def change
change_column :campaigns, :fund_goal, :integer, :default => 0
change_column :campaigns, :fund_amount, :integer, :default => 0
end
end
|
#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'config', 'environment'))
# 1. Выбираем проекты из списка.
project_ids = File.readlines('tmp/del.txt').map(&:to_i)
# 2. Выбираем проекты для работы.
projects = Project.includes(:card, :user,
:research_are... |
class AddUserToLegacyUsers < ActiveRecord::Migration
def change
add_reference :legacy_users, :user, index: {unique: true}, foreign_key: true
end
end
|
class Account
attr_reader :id
attr_reader :balance
PENALTY = 5.00
def initialize _id, _balance
@id = _id.to_i
@balance = _balance.to_f.round 2
end
def transaction amount
amount.to_f.round 2
@balance += amount
penalize if @balance < 0.0 and amount < 0.0
@balance = @balance.round 2
... |
class FightersGuild::FightersGuildController < ApplicationController
check_authorization
rescue_from CanCan::AccessDenied do |exception|
redirect_to new_user_registration_path, :alert => exception.message
end
before_filter :set_lists
private
def set_lists
@questpages = Questpage.all
end
... |
require_relative '../../test_helper'
require 'sidekiq/testing'
class Bot::Smooch3Test < ActiveSupport::TestCase
def setup
super
setup_smooch_bot
end
def teardown
super
CONFIG.unstub(:[])
Bot::Smooch.unstub(:get_language)
end
test "should create media" do
Sidekiq::Testing.inline! do
... |
# Curve25519+ECDH implementation in Ruby
# Disclaimer: This code is for learning purposes ONLY. It is NOT secure.
# Tanner Prynn
require 'SecureRandom'
require 'digest'
# Fast Modular Exponentiation (base**exp % mod)
def modexp(base, exp, mod)
prod = 1
base = base % mod
until exp.zero?
exp.odd? and ... |
# -*- encoding: utf-8 -*-
require 'yaml'
module TTYCoke
class Config
include TTYCoke::Log
def initialize(config_file=ENV['HOME'] + "/.ttycokerc")
log_rescue(self, __method__, caller, TTYCoke::Errors::YamlSyntaxError) {
@files = {
init: config_file,
tty_coke: File.dirname(__... |
class Socat < Formula
homepage "http://www.dest-unreach.org/socat/"
url "http://www.dest-unreach.org/socat/download/socat-1.7.3.0.tar.gz"
sha1 "c09ec6539647cebe8fccdfcf0f1ace1243231ec3"
bottle do
cellar :any
sha1 "1dbd28a373b01b68aa18882f27a4ad82a75cdcd6" => :yosemite
sha1 "af4f37fa4ac0083200f6ede2... |
require_relative '../test_helper'
class ClientTest < Minitest::Test
include TestHelpers
def test_it_creates_client_with_correct_attributes
create_payloads(1)
client = Client.find(1)
assert_equal "jumpstartlab0", client.identifier
assert_equal "http://jumpstartlab.com0", client.root_url
end
d... |
require 'spec_helper'
describe "Prism Type requests" do
describe "GET unpublished /prism_type" do
it "should return a 404" do
p = PrismType.make!(:published => false)
get prism_type_path(p)
assert_response :missing
end
end
describe "GET published /prism_type" do
it "should return a valid page" do
... |
# encoding: UTF-8
# Copyright 2011-2013 innoQ Deutschland GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
require 'test_helper'
class DecimalConverterTest < ActiveSupport::TestCase
test 'decimal_to_sexagesimal should return sexagesimal with reverse' do
res = DecimalConverter.decimal_to_sexagesimal(666)
assert_equal '6b', res
end
test 'sexagesimal_to_decimal should return decimal' do
res = DecimalConvert... |
class ProjectsController < ApplicationController
before_action :find_project, only: [:show, :edit, :update, :destroy, :complete, :started, :stopped]
def index
@projects= Project.all.order("created_at DESC")
end
def new
@project = Project.new
end
def create
@project=Project.new(projec... |
module DeployIt
module Configurators
class Rails
attr_reader :project
def initialize(project)
@project = project
end
def to_hash
{
postgresql: {
password: {
postgres: project.db_admin_password
}
},
"deplo... |
class Session < ApplicationRecord
validates :username, :password, presence: true
end
|
require 'rails_helper'
RSpec.describe 'Book Index Page', type: :feature do
describe 'as a visitor visiting the books index page' do
before :each do
@book_1 = Book.create!(title: "The Hobbit")
@book_2 = Book.create!(title: "Fun & Games")
end
it 'shows all book titles in the database, and each... |
module AccountsHelper
def admin_link_to_account(account)
link_to(admin_account_path(account.id)) { account_with_avatar(account) }
end
def account_with_avatar(account)
safe_join([
avatar_for(account),
content_tag(:span, account, class: 'text-bold')
], ' ')
end
def hero_tldr_roles(hero... |
class CheetahFactorRankingsController < ApplicationController
include Navigation::PathGeneration
helper FactorRating
layout "quiz"
def first_custom
program = Program.find_by(slug: params[:program_id])
section = Section.find_by(slug: params[:section_id])
factors = current_user.rateable_custom_cheet... |
require 'digest/md5'
class Profile < ActiveRecord::Base
has_many :measurements, :order => 'created_at ASC'
before_validation :generate_md5
before_save :generate_statistics
validates_uniqueness_of :md5
default_scope where(:included => true)
scope :average_accuracy_top, lambda{|qty| where('average_acc... |
require 'json'
require_relative '../logging'
class Xamarin
extend Logging
@XAMARIN_ANDROID_GUID = "{EFBA0AD7-5A72-4C68-AF49-83D382785DCF}";
@XAMARIN_IOS_GUID = "{FEACFBD2-3405-455C-9665-78FE426C6842}";
def self.scan(path)
results = []
# Must have csproj containing Xamarin Android or iOS project gu... |
class Api::V1::CharactersController < ApplicationController
film = Film.new
def index
characters = Character.all
render json: characters, status: 200
end
def create
character = Character.new(
name: character_params[:name],
actor: character_params[:actor],
film: character_pa... |
require "setup"
require "cubic/workers/base"
class TestBaseWorker < Minitest::Test
def setup
@worker = Cubic::Workers::Base.new
end
def test_rehearal
result = nil
@worker.rehearsal do
result = 1
end
assert_equal 1, result
end
def test_log_error
out, _ = capture_subprocess_io ... |
require 'rails_helper'
RSpec.describe PollsHelper, type: :helper do
describe '#poll_date' do
let!(:nimp) { 'test' }
let!(:time) { Time.zone.now }
it 'shall give unchanged expr' do
expect(helper.poll_date(nimp)).to eq(nimp)
end
it 'shall transate a date' do
expect(helper.poll_date(time... |
require_relative 'compare-sort'
require 'rspec'
describe "ValidateData" do
it "raises no error if data is array" do
expect { ValidateData.run([]) }.not_to raise_error
end
it "raises an error if data is not an array" do
expect { ValidateData.run({}) }.to raise_error
end
it "raises an error if data is not A... |
class AddProfileRefToMatches < ActiveRecord::Migration
def change
add_reference :matches, :profile, index: true
end
end
|
module Calypso
module GithubClient
module ProjectsAPI
def projects
fetch(projects_url)
end
def project(name)
projects.select { |p| p['name'] == name }.first
end
def project_issues(project_name:, column_name: nil, state: 'closed')
project = project(project... |
class UserTestObserver < ActiveRecord::Observer
def after_create(user_test)
UserTestMailer.deliver_signup_notification(user_test)
end
def after_save(user_test)
UserTestMailer.deliver_activation(user_test) if user_test.recently_activated?
end
end
|
class PhotosController < ApplicationController
protect_from_forgery prepend: true
before_action :authenticate_admin!
before_action :fill_attr, only: [:new, :create]
#def index
# @photos = Photo.all
#end
def new
end
def create
if @photo.valid?
@photo.save
redirect_to collections_p... |
# Definition for a binary tree node.
class TreeNode
attr_accessor :val, :left, :right
def initialize(val = 0, left = nil, right = nil)
@val = val
@left = left
@right = right
end
end
# @param {TreeNode} s
# @param {TreeNode} t
# @return {Boolean}
def is_subtree(s, t)
traverse... |
# frozen_string_literal: true
module Admin
class ProductsController < Admin::BaseController
# GET /products
def index
@products = Product.all
end
# GET /products/1
def show
@product = product
end
# GET /products/new
def new
render :form, locals: { product: Product.... |
module Retrocalc
class StructureTypeJsonPresenter
attr_reader :audit_strc_type
def initialize(audit_strc_type)
@audit_strc_type = audit_strc_type
end
def as_json
{
name: audit_strc_type.name,
api_name: audit_strc_type.api_name,
genus_api_name: audit_strc_type.genu... |
# frozen_string_literal: true
class NonOccupantsController < ApplicationController
def index
@q = non_occup_query
@pagy, @non_occupants = pagy(@q.result)
@house_id = params.dig(:q,:house_id) || params.dig(:house_id)
end
def update
redirect_to houses_path and return unless house_id
non_occupa... |
# What is your name? Some known vampires are in the area, and we can check against the Werewolf Intelligence Bureau database for their aliases.
# How old are you? What year were you born? This is to try to trick the vampire, who is likely several hundreds of years old. If an employee gives an age and a year of birth... |
# frozen_string_literal: true
Sequel.migration do
transaction
up do
create_table(:foos) do
String :name, size: 255
end
end
end
|
class CustomSessionsController < Devise::SessionsController
def create
super
flash[:success] = t('.welcome', name: current_user.name)
end
end
|
require "rails_helper"
RSpec.describe CreditCompaniesController, :type => :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/credit_companies").to route_to("credit_companies#index")
end
it "routes to #new" do
expect(:get => "/credit_companies/new").to route_to("cred... |
class BookingsController < ApplicationController
before_action :set_skill, only: [ :create]
def create
@booking = Booking.new(booking_params)
@booking.skill = @skill
@booking.user = current_user
if @booking.save
redirect_to user_path(current_user)
else
@user = @skill.user
rend... |
class DNA
def initialize(strand)
@strand = strand
end
def hamming_distance(other_strand)
effective_length = [@strand.size, other_strand.size].min
effective_length.times.count do |idx|
@strand[idx] != other_strand[idx]
end
end
end
# def hamming_distance(other_strand)
# pairs = @strand.c... |
require 'hmac-sha2'
require 'base64'
module Cybersourcery
class CybersourceSigner
attr_accessor :profile, :signer
attr_writer :time
attr_writer :form_fields
attr_reader :signable_fields
IGNORE_FIELDS = %i[
commit
utf8
authenticity_token
action
controller
]... |
Grauer::Application.routes.draw do
devise_for :users, controllers: {
registrations: 'users/registrations' ... |
# Virus Predictor
# I worked on this challenge [by myself, with: Catherine V. ].
# We spent [1.5] hours on this challenge.
# EXPLANATION OF require_relative
# require_relative allows us to access a file in the same
# directory without having to copy the direct code
# require looks through ruby gems to see if a certa... |
class CreateStatisticDailies < ActiveRecord::Migration
def change
create_table :statistic_dailies do |t|
t.float :mu
t.integer :tier_id
t.integer :division
t.integer :matches_played
t.integer :mmr
t.integer :playlist_id
t.string :player_id
t.date :stat_date
end
... |
require 'spec_helper'
include OwnTestHelper
describe "Beer page" do
it "has a link to creating a new beer if user is signed in" do
user = FactoryGirl.create :user
sign_in username:user.username, password:"Foobar1"
visit beers_path
expect(page).to have_content "New Beer"
end
it "no link for crea... |
class Vaccination < ApplicationRecord
has_many :baby_vaccinations, dependent: :destroy
has_many :babies, through: :baby_vaccinations
validates :age, presence: true
validates :title, presence: true
end
|
# class Player
class Player
attr_accessor :name, :token, :won, :moves
def initialize(name, token, won)
@name = name
@token = token
@won = won
@moves = []
end
end
|
# -*- coding : utf-8 -*-
require 'spec_helper'
describe Mushikago::Hanamgri::UpdateDomainRequest do
shared_examples_for ' a valid request instance for update_domain' do |n, d, o|
subject{ Mushikago::Hanamgri::UpdateDomainRequest.new(n, d, o) }
it{ should be_kind_of(Mushikago::Http::PostRequest) }
its(:pa... |
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :reset_session
before_action :configure_permitted_parameters, if: :devise_controller?
def configure_permitted_parameters
... |
class Ability
include CanCan::Ability
def initialize(thisuser)
thisuser ||= User.new #guest account
if thisuser.has_role? :manager
can :manage, :all
elsif thisuser.has_role? :participant
can :manage, [ Home, Activity, Registration, Agency, Event, Sponsor, Team ]
can :... |
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
#Getting capybara ready for use
#require "capybara/rails"
# require "capybara/rails"
# require "minitest/rails/capybara"
class ActiveSupport::TestCase
ActiveRecord::Migration.check_pending!
# Setup... |
require 'spec_helper'
feature "goal tracking" do
#Log in, get to user's show page
before(:each) do
visit new_user_url
sign_up("foo")
end
feature "creating goals" do
let(:current_user) { User.find_by_username("foo") }
it "doesn't create goals without a title" do
click_button "Add Goal"
... |
FactoryBot.define do
factory :sistema_usuario, class: 'Sistema::Usuario' do
nombre { Faker::Name.name }
email 'foo@bar.com'
password 'foobar'
password_confirmation 'foobar'
end
end
# ## Schema Information
#
# Table name: `sistema_usuarios`
#
# ### Columns
#
# Name | Type ... |
# http://www.mudynamics.com
# http://labs.mudynamics.com
# http://www.pcapr.net
require 'mu/scenario/pcap'
module Mu
class Scenario
module Pcap
class Fields
FIELDS = [
:rtp,
:"rtp.setup-frame"
].freeze
FIELD_COUNT = FIELDS.length
SEPARATOR = "\xff".freeze
TSHARK_OPTS = "-Esepara... |
class Article < ActiveRecord::Base
has_many :events
has_many :users, through: :events
default_scope {order ('created_at DESC')}
end
|
# frozen_string_literal: true
# rubocop:todo all
require_relative './performs_modern_retries'
require_relative './performs_no_retries'
module SupportsModernRetries
shared_examples 'it supports modern retries' do
let(:retry_writes) { true }
context 'against a standalone server' do
require_topology :si... |
# frozen_string_literal: true
module Mutations
module Games
class UpdateGame < ::Mutations::BaseMutation
argument :game_id, Integer, required: true
argument :player, String, required: true
argument :board, Types::Input::BoardInputType, required: true
type Types::GameType
def reso... |
require 'rails_helper'
RSpec.describe MainController, :type => :controller do
describe "Won card" do
before do
@joe = FactoryGirl.create(:facebook_user)
@john = FactoryGirl.create(:twitter_user)
@techniques_card = FactoryGirl.build(:techniques_card)
@tools_card = FactoryGirl.build(:tools_... |
module Front::BaseHelper
include ApplicationHelper
def front_menu_class(actual_menu_name)
menus = {
appreciations: ["/front/appreciations.*"]
}
menu_class(menus, actual_menu_name)
end
def appreciation_custom_style(appreciation)
return "style_no_saved" if appreciation.uuid.nil?
styl... |
require 'spec_helper'
describe Schema do
context "The Schema class" do
it "should parse a schema" do
schema = Schema.build('config/schemas/stix/stix_core.xsd')
schema.should_not be_nil
schema.namespace.should == "http://stix.mitre.org/stix-1"
schema.prefix.should == "stix"
Schema.f... |
class Painel::UsersController < Painel::BaseController
before_action :set_users, :only => [ :update, :show, :updatepassword ]
# before_filter :validate_user, :only => :show
def index
@users = User.where(:level => 0)
end
def new
@user = User.new
end
def create
@user = User.new(user_params_c... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'perf_framework/version'
Gem::Specification.new do |spec|
spec.name = "perf_framework"
spec.version = PerfFramework::VERSION
spec.authors = ["Abin Shahab"]
spec.email ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.