text stringlengths 10 2.61M |
|---|
require_relative '../spec_helper'
require_relative '../../helpers/email'
require_relative '../../helpers/logger'
require_relative '../../helpers/link'
describe 'Email Helper' do
include Email
include MagicLogger
include Link
attr_reader :settings
before(:all) do
@owner = User.new(
username: 'owner... |
require 'spec_helper'
describe PrimeTable do
before do
@prime_table = PrimeTable.new
end
describe 'prime_number? method' do
it 'returns true for prime number' do
expect(@prime_table.prime_number?(5)).to eq true
end
it 'returns false for non prime numbers' do
expect(@prime_table.prim... |
module Vanilla
module Resource
# Delegate to a Vanilla::Client
#
# @return [Vanilla::Client]
def client
@client ||= Vanilla::Client.new
end
private
def method_missing(method_name, *args, &block)
return super unless client.respond_to?(method_name)
client.send(method_name,... |
require 'rails_helper'
describe Contact do
describe "Validations" do
context "invalid attributes" do
it "is invalid without a name" do
contact = Contact.new(position: "To be filled", email: "no@no.no")
expect(contact).to be_invalid
end
it "is invalid without a position" do
... |
class ArticleComment < ActiveRecord::Base
attr_accessible :article_id, :content, :email, :name, :author_id, :website
belongs_to :article
belongs_to :author, :class_name => 'User'
after_save :after_save
after_destroy :after_destroy
validates :name,
:length => { :maximum => 250, :too_long => "Maximum ... |
begin
require 'ipaddress'
rescue => e
puts e.message
puts e.backtrace.inspect
end
require_relative '../../puppet_x/bsd'
require_relative '../../puppet_x/bsd/puppet_interface'
class Rc_conf < PuppetX::BSD::PuppetInterface
def initialize(config)
validation :name
options :desc, :addresses, :options, :ra... |
=begin
* ****************************************************************************
* BRSE-SCHOOL
* ADMIN - RegistCourseController
*
* 処理概要 :
* 作成日 : 2017/08/18
* 作成者 : quypn – quypn@ans-asia.com
*
* 更新日 :
* 更新者 :
* 更新内容 :
*
... |
class Favorite < ApplicationRecord
validates_uniqueness_of :user_id, :scope => :video_id
belongs_to :user
belongs_to :video
end
|
class RemoveAddress2FromCity < ActiveRecord::Migration
def change
remove_column :cities, :address_2, :string
end
end
|
class DeleteAppUserIdInAppSessions < ActiveRecord::Migration
def up
AppSession.find_each do |app_session|
next if app_session.app_user_id.nil?
app_session.update_properties app_user_id: app_session.app_user_id
end
remove_column :app_sessions, :app_user_id
end
def down
add_column :app... |
class Photo < ApplicationRecord
validates_format_of :photo_url, with: URI.regexp(['http', 'https'])
validate :one_profile_photo
belongs_to :pet
def one_profile_photo
return if profile_photo == false ||
self.class.where(pet_id: self.pet_id).where(profile_photo: true).size == 0
errors.add(:pet_id... |
class AddPosterToProjects < ActiveRecord::Migration
def change
add_column :entries, :poster, :string
end
end
|
class AddDefaultPriceToTshirt < ActiveRecord::Migration[5.2]
def change
change_column :tshirts, :price, :float, :default => 10.00
end
end
|
class RemoveColumnFromInventoryItems < ActiveRecord::Migration[6.0]
def change
remove_column :inventory_items, :is_sellable, :boolean
end
end
|
# -*- encoding: utf-8 -*-
# stub: hanami 1.2.0 ruby lib
Gem::Specification.new do |s|
s.name = "hanami"
s.version = "1.2.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.metadata = { "allowed_push_host" => "https://rubygems.org" } if s.respond_to? :m... |
require 'spec_helper'
describe 'balloons/edit' do
let(:balloon) { Balloon.create!(name: 'Jorge') }
before do
assign(:balloon, balloon)
render
end
subject { rendered }
it { should match 'Edit Balloon' }
specify { expect(view).to render_template(partial: 'balloons/_form') }
end
|
class AddColToTickets < ActiveRecord::Migration[6.0]
def change
add_column :tickets, :seat_class, :string
add_column :tickets, :seat_no, :string
end
end
|
require 'spec_helper'
describe KeyRedis, type: :model do
describe 'KeyRedis#create_key' do
it '创建一个key, 同时更新长度' do
key_redis = KeyRedis.create
_key = key_redis.create_key
expect(_key).to eq '000001'
key_redis.key_length = 5
_key = key_redis.create_key
expect(_key).to eq '00... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.define "nginx" do |nginx|
nginx.vm.hostname = "nginx.example.com"
nginx.vm.box = "generic/centos7"
nginx.vm.network "forwarded_port", guest: 80, host:8080, host_ip: "127.0.0.1"
nginx.vm.network "pr... |
class AddUserIdToProductos < ActiveRecord::Migration
def change
add_reference :productos, :user, index: true
end
end
|
class MoveFreightChargeToOrder < ActiveRecord::Migration
def up
add_column :orders, :freight_charge, :decimal, precision: 9, scale: 2
remove_column :order_items, :freight_charge
end
def down
add_column :order_items, :freight_charge, :decimal
remove_column :orders, :freight_charge
end
end
|
class User < ActiveRecord::Base
has_many :lists
has_many :tasks, through: :lists
def self.the_current_user_method
recent_user = self.all.sort_by { |user| user.last_log_in }.reverse.first
if (Time.now - recent_user.last_log_in)/10000000 > 3600.0
raise "You need to sign someone in, try passing 'sign_... |
require 'helper'
require 'active_record'
require 'integration/helper'
class ArSqliteTest < MiniTest::Unit::TestCase
DBNAME = 'lmapper.sqlite'
def init_db
if File.directory?('tmp')
File.unlink('tmp/#{DBNAME}') if File.exists?('tmp/#{DBNAME}')
else
Dir.mkdir('tmp')
end
ActiveRecord::Ba... |
# Copyright (c) 2013 Altiscale, inc.
#
# 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 applicable law or agreed to in w... |
module Meiosis
class Config
class << self
attr_accessor :wallet, :api
attr_reader :privkey
def init(env_vars)
if !env_vars["privkey"]
@privkey = SecureRandom.random_bytes(32)
@keyclass = Secp256k1::PrivateKey.new({privkey: @privkey})
else
@privkey = ... |
require 'rails_helper'
require 'factories'
describe "get all states route", :type => :request do
let!(:states) { FactoryBot.create_list(:state, 29)}
before { get '/states'}
it 'returns all states' do
expect(JSON.parse(response.body).size).to eq(29)
end
it 'returns status code 200' do
expect(respon... |
require "rails_helper"
RSpec.describe Api::LtiLaunchesController, type: :controller do
before do
setup_lti_users
setup_application_instance
@content_item = {
"@context" => "http://purl.imsglobal.org/ctx/lti/v1/ContentItem",
"@graph" => [{
"@type" => "ContentItem",
"mediaType"... |
# ------------
# Question #1
# ------------
# Ben is right. He is using an attr_reader, which sets up a getter method called balance behind the scenes. balance in the positive_balance? method calls the getter method and returns the @balance variable.
# ------------
# Question #2
# ------------
# Alyssa's mistake is ... |
json.all_persons_info @persons do |person|
json.person_id person.id
json.first_name person.first_name
json.last_name person.last_name
json.birthday person.birthday
json.email person.email
json.password person.password
json.phone person.phone
json.address person.address
json.city person.city
json.sta... |
class CurrenciesController < ApplicationController
before_action :set_currency, only: [:edit, :update]
before_action :logged_in_user
def index
@q = current_user.currencies.search(params[:q])
@currencies = @q.result(distinct: true)
@currency = current_user.currencies.build
end
def new
... |
# require 'Clipboard'
When(/^The customer selects the "([^"]*)" dispute reason$/) do |arg|
on(DisputesPage).select_surcharge_radio_no_option
on(DisputesPage).surcharge_radio_no_option_selected?.should be true
on(DisputesPage).reason_option_selection = arg
end
Then(/^The page will display selected reason descri... |
class HN
class Item
attr_accessor :id
attr_accessor :title, :url
attr_accessor :user_id, :content
def initialize(params)
@id = params[:id]
@title = params[:title]
@url = params[:url]
@user_id = params[:user_id]
@content = params[:content]
end
def comments
... |
class Donation < ApplicationRecord
validates :cuenta, presence: true, uniqueness:true, length: {minimum: 6}
validates :banco, presence: true, length: {maximum: 60}
validates :detalle, presence: true
end
|
class TranslationsController < ApplicationController
before_filter :authenticate_user!
def create
@passage = Phrase.find(params[:phrase_id])
@new_translation = @passage.translations.build(trans_params)
@new_translation.user = current_user
if @new_translation.save
flash[:notice] = "Translatio... |
require '../spec_helper.rb'
require './substrings.rb'
describe "substrings" do
it "creates a hash with number of times words in array are contained in string" do
expect(substrings("below", ["below", "down", "go", "going", "horn", "how", "howdy", "it", "i", "low", "own", "part", "partner", "sit"])).to include(
"b... |
class Facility < ActiveRecord::Base
has_many :institution_facilities
has_many :institutions, through: :institution_facilities
end
|
class UserStoriesController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:update_priority]
def create
@user_story = UserStory.new(user_story_params)
if @user_story.save
puts "*****WE SHOULDNT BE HERE ****"
redirect_to :controller => "sprints", :action => "show",... |
class ThemesController < ApplicationController
before_action :set_theme, only: [:show, :destroy, :edit, :update]
def index
@theme = Theme.new
@themes = Theme.includes(:user).order("created_at DESC")
end
def create
Theme.create(theme_params)
redirect_to root_path
end
def show
@post = ... |
require 'rails_helper'
RSpec.describe 'ユーザ管理機能', type: :system do
before do
@normal = FactoryBot.create(:normal)
@admin = FactoryBot.create(:admin)
end
describe 'ユーザ登録' do
context 'ユーザを新規作成した場合' do
it '作成したユーザの詳細ページが表示される' do
visit new_user_path
fill_in 'Name', with: 'test'
... |
# frozen_string_literal: true
require "sentry/utils/exception_cause_chain"
module Sentry
class SingleExceptionInterface < Interface
include CustomInspection
SKIP_INSPECTION_ATTRIBUTES = [:@stacktrace]
PROBLEMATIC_LOCAL_VALUE_REPLACEMENT = "[ignored due to error]".freeze
OMISSION_MARK = "...".freeze... |
class PaperTrail::VersionPolicy < ApplicationPolicy
def index?
(user.is_admin? or user.is_volunteer?) if user
end
def show?
(user.is_admin? or user.is_volunteer?) if user
end
end
|
class PaymentsController < ApplicationController
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found_response
rescue_from ActiveRecord::RecordInvalid, with: :render_unprocessable_entity_response
def index
payments = Payment.all
render json: payments
end
def create
... |
require 'spec_helper'
describe DashboardController do
render_views
let(:user) { User.make! }
before(:each) do
sign_in user
end
it "should render the dashboard" do
deployment = Deployment.make!(:user => user, :name => 'Example deployment')
cloud_provider = CloudProvider.make!
Cloud.make!(:clo... |
class Admin::EuDecisionTypesController < Admin::StandardAuthorizationController
def index
index! do |format|
format.json {
render :json => EuDecisionType.dict.sort.to_json
}
end
end
def create
create! do |failure|
failure.js { render 'new' }
end
end
protected
def... |
module Auth::Controllers::SignInOut
def sign_in(scope, resource, options = {})
expire_data_after_sign_in!
if options[:bypass]
warden.session_serializer.store(resource, scope)
elsif warden.user(scope) == resource # && !options.delete(:force)
# Do nothing. User already signed in and we are not ... |
class UtilService
class << self
def experiment(name)
service_name = name.split('_').map(&:capitalize).join
service = Object.const_get("#{service_name}Service")
raise BadRequestError.new('Service Not Match') unless service < ExperimentService
service
end
end
end
|
Given(/^service on "(.+)"$/) do |url|
@service = Infra['soap.client'].new(wsdl: url)
end
When(/^execute operation (\S+)$/) do |name|
@response = @service.call(name.to_sym)
end
Then(/^response body is presented$/) do
body = @response.body
log body
expect(body.empty?).to be false
end |
class CreateChats < ActiveRecord::Migration
def change
create_table :chats do |t|
t.references :question_friend, index: true
t.string :message
t.boolean :is_from
t.timestamps
end
end
end
|
require 'rails_helper'
RSpec.feature "Listing exercises" do
before do
@john=User.create(first_name:"alex",last_name:"shyaka",email:"shyakaster@gmail.com",password:"password")
@sarah=User.create(first_name:"sarah",last_name:"shyaka",email:"sarah@gmail.com",password:"password")
login_as @john
@e1=@john... |
require 'json'
require 'yaml'
VAGRANT_DOTFILE_PATH = 'bin/.vagrant'
if(ENV['VAGRANT_DOTFILE_PATH'].nil? && '.vagrant' != VAGRANT_DOTFILE_PATH)
puts "\033[#1;#33;#40m "
puts ' changing metadata directory to ' + VAGRANT_DOTFILE_PATH
ENV['VAGRANT_DOTFILE_PATH'] = VAGRANT_DOTFILE_PATH
puts ' removing defaul... |
require 'rails_helper'
RSpec.describe 'merchant discount destroy' do
before :each do
Merchant.destroy_all
Discount.destroy_all
@merchant1 = create(:merchant)
@discount_1 = @merchant1.discounts.create!(name: "TENoffTEN", percentage_discount: 10, quantity_threshold: 10, merchant_id: @merchant1.id)
... |
require "date"
require "fixnum"
class DateRangeFormatter
def initialize(start_date, end_date, start_time = nil, end_time = nil)
@start_date = Date.parse(start_date)
@end_date = Date.parse(end_date)
@start_time = start_time
@end_time = end_time
end
##
# The code repeats itself many times. This ... |
require 'spec_helper'
describe Tournament do
let(:rock_player) { RockPlayer.new }
let(:paper_player) { PaperPlayer.new }
let(:scissors_player) { ScissorsPlayer.new }
it 'should be a tournament' do
expect(subject).to be_a(Tournament)
end
describe ".load_players" do
it "loads the list of players" do... |
# frozen_string_literal: true
RSpec.describe NilRemoteAd do
let(:ad) { described_class.new }
%i[reference status description].each do |attr|
describe "##{attr}" do
subject { ad.send(attr) }
it { is_expected.to eq 'Non Existent' }
end
end
end
|
class Api::ReviewsController < ApplicationController
before_action :set_item
def index
render json: @item.reviews
end
def create
end
def update
end
def destroy
end
private
def set_item
@item = Items.find(params[:item_id])
end
end |
require 'test_helper'
class DemandasControllerTest < ActionController::TestCase
setup do
@demanda = demandas(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:demandas)
end
test "should get new" do
get :new
assert_response :success
en... |
class Subject < ActiveRecord::Base
has_many :feedbacks
# has_and_belongs_to_many :courses
has_many :course_subjects
has_many :courses, through: :course_subjects
validates :name, presence: true
validates :description, presence: true
end
|
#!/usr/bin/ruby
require 'mongoid'
require 'json'
require_relative '../models/place'
require 'pry'
env = 'development'
ARGV.each do |arg|
arg_split = arg.split "="
if arg_split[0] == 'env'
if arg_split[1] == 'development' || arg_split[1] == 'test'
env = arg_split[1]
elsif arg_split[1] == 'productio... |
require 'rmagick'
require 'fileutils'
require_relative 'imgen/color_names'
module Imgen
class Image
# main entry point
def initialize(options)
1.upto(options[:quantity]) do
img = Magick::Image.new(options[:width], options[:height])
#img.colorspace = Magick::RGBColorspace
colors ... |
#
# 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... |
module Mastermind
class Result
attr_accessor :line
def initialize(line)
@line = line
end
def <=>(other)
score <=> other.score
end
def score
[rounds, seconds]
end
def rounds
@line[/\d+ rounds/].to_i
end
def seconds
@line[/\d+ seconds/].to_i
... |
class Neighbor < ActiveRecord::Base
belongs_to :neighbor, :class_name => 'Household'
belongs_to :household
before_create :set_default_read
def set_default_read
#self.read = "f"
end
def send_neighbor_request_email(neighbor)
@users = User.find(:all, :conditions => {:household_id => neighbor.nei... |
module ScorchedEarth
module Subscribers
module NextPlayer
def setup
super
event_runner.subscribe(Events::MouseReleased) do |_event|
@players = players.rotate!
end
end
end
end
end
|
# Control series where on player has a secret which the other guesses
class SecretBased < Controller
private
def setup_round
@series.new_game(@id_of_leader)
@series.choose_secret(@id_of_leader ^ 1)
end
def play_round
game_over ||= @series.take_turn(@id_of_leader) until game_over
game_over == '... |
class CreateTasks < ActiveRecord::Migration
def change
create_table :tasks do |t|
t.string :name
t.string :description
t.datetime :time
t.integer :duration
t.string :regulars
t.boolean :ready
t.integer :user_id
t.timestamps
end
add_index :tasks, :user_id
... |
# frozen_string_literal: true
class AddRelationToInvoice < ActiveRecord::Migration[4.2]
def change
add_column :registration_groups, :invoice_id, :integer
add_foreign_key :registration_groups, :invoices
end
end
|
require 'application_system_test_case'
class UserFlowsTest < ApplicationSystemTestCase
setup :setup_omniauth, :setup_auth_hash
test 'log in with facebook and subscribe to calendar' do
visit root_path
click_button I18n.t(:login)
assert_selector '#subscribe-button'
click_button I18n.t(:subscribe)... |
can_compile_extensions = false
begin
require 'mkmf'
can_compile_extensions = true
rescue Exception
# This will appear only in verbose mode.
$stderr.puts "Could not require 'mkmf'. Not fatal, the extensions are optional."
end
if can_compile_extensions && have_header('ruby.h')
extension_name = 'ccurl'
dir_c... |
# Ask user for info
# use gets chomp to store their response as the value in a certain key in the hash
# have hash already set up with keys and empty values
# puts user information out as list after all questions have been answered
# ask user if they would like to modify answers
# if yes then ask them to enter in the k... |
require 'sinatra/base'
require 'erb' # use Erb templates
require 'httparty'
require 'nokogiri'
require 'mongoid'
require 'mongoid_token'
require 'mongoid-pagination'
require 'addressable/uri'
Mongoid.load!('./mongoid.yml', (ENV['RACK_ENV'] || 'development'))
class Takeover
include Mongoid::Document
include Mongoi... |
RSpec.describe Api::V1::AuthController, type: :controller do
describe 'POST #create' do
let!(:resource) { create(%i[client staff].sample, password: 'password') }
context 'valid credentials' do
let(:valid_params) { { email: resource.email, password: 'password', scope: resource.class.to_s } }
it '... |
module WsdlMapper
module Dom
class Documentation
attr_reader :default
attr_accessor :app_info
def initialize(text = nil)
@default = text
end
def present?
!@default.nil?
end
end
end
end
|
module Faker
class Class < Base
flexible :class
class << self
def name
parse('class.name')
end
def prefix; fetch('class.prefix'); end
def subject; fetch('class.subject'); end
end
end
end
|
# Definition for a binary tree node.
# class TreeNode
# attr_accessor :val, :left, :right
# def initialize(val)
# @val = val
# @left, @right = nil, nil
# end
# end
# @param {TreeNode} root
# @param {Integer} sum
# @return {Boolean}
def has_path_sum(root, sum)
if root == nil... |
require 'rspec'
require 'hyperclient'
require 'json'
# silence rantly output
ENV['RANTLY_VERBOSE'] = '0'
HAL = 'application/hal+json'
HAL_REGEX = Regexp.escape(HAL)
HTTP_OK = 200
TEST_DEBUG = ENV['TEST_DEBUG']
def api_root
ENV['API_ROOT_URL'] || (raise Runtime... |
class User < ApplicationRecord
rolify
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
#:confirmable
#ROLES = %w[admin ma... |
FactoryBot.define do
factory :reservationc do
name { "MyString" }
start_time { "2020-12-14 13:55:12" }
end
end
|
class Book < ActiveRecord::Base
has_and_belongs_to_many :authors
# attr_accessible :title, :description
validates :title, :presence => true
# def self.search(search)
# find(:all, :conditions => ['title LIKE ?', "#{search}"])
# end
def self.search(search)
if search
where('title LIKE ?', "%#{sea... |
# frozen_string_literal: true
require 'spec_helper'
require 'et_azure_insights/adapters/rack'
require 'et_azure_insights'
require 'rack/mock'
RSpec.describe EtAzureInsights::Adapters::Rack do
include_context 'fake client'
let(:fake_app_response) { [200, {}, 'app-body'] }
let(:fake_app) { spy('Rack app', call: fa... |
class AddLocationIdToSharePrizes < ActiveRecord::Migration
def change
# In the existing code, a Location can share a prize with a user
# (see the 'add_prize_user' method in NotificationController).
# This isn't ideal, but refactoring will be a substantial effort,
# so the easiest solution is to add a ... |
# frozen_string_literal: true
module CodebreakerVk
class Game
include Output
SECRET_CODE_LENGTH = 4
RANGE_START = 1
RANGE_END = 6
NOT_YET = '-'
GOT_IT = '+'
DIFFICULTY_LEVEL = {
easy: { attempts: 15, hints: 3 },
medium: { attempts: 10, hints: 2 },
hell: { attempts: 5, hi... |
class CreateExhibitionsTags < ActiveRecord::Migration
def change
create_table :exhibitions_tags, :id => false do |t|
t.references :exhibition, index: true, foreign_key: true
t.references :tag, index: true, foreign_key: true
end
end
end
|
require 'formula'
class Mdxmini < Formula
homepage 'http://clogging.web.fc2.com/psp/'
url 'https://github.com/BouKiCHi/mdxplayer/archive/9afbc01f60a12052817cb14a81a8c3c976953506.tar.gz'
version '20130115'
sha1 '8ca3b597f009ee7de697329e26b9f3c402dda173'
option "lib-only", "Do not build commandline player"
... |
class AddIndexForMediaEventCaliperEventReference < ActiveRecord::Migration[5.0]
disable_ddl_transaction!
def change
add_index :media_events, :caliper_event_id, algorithm: :concurrently
end
end
|
class PollsController < ApplicationController
before_action :set_poll, only: [:show, :edit ,:update ,:destroy]
def index
@polls = Poll.where(user_id: params[:user_id])
if session[:flag]==0
redirect_to poll_index1_path(params[:user_id])
end
end
def index1
@polls = Poll.where(u... |
class CreateCoders < ActiveRecord::Migration[5.1]
def change
create_table :coders do |t|
t.text :first_name
t.text :last_name
t.text :about
t.text :looking_for
t.text :img_url
t.timestamps
end
end
end
|
class SkillsController < ApplicationController
before_action :authenticate_user!
def index
@skills = current_user.skills.order(:id) if current_user
@skill = Skill.new
end
def new
@skill = Skill.new(user: current_user)
@small_target = Target.new()
end
def edit
@skill = Skill.find(param... |
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# Ch... |
class Task < ActiveRecord::Base
attr_accessible :complete, :name, :id
belongs_to :user
end
|
# Operator Overloading
class Animal
attr_accessor:name,:trait
def initialize(name, trait)
@name = name
@trait = trait
end
#Operator overloading
def + (other_object)
return Animal.new("#{self.name}#{other_object.name}", "#{self.trait}#{other_object.trait}") # we can access object a by using sel... |
class H0200b
attr_reader :options, :name, :field_type, :node
def initialize
@name = "Urinary Toileting Program: Response - What was the resident's response to the trial program? (H0200b)"
@field_type = RADIO
@node = "H0200B"
@options = []
@options << FieldOption.new("^", "NA")
@options << ... |
class AddUserIdToKingbehemoth < ActiveRecord::Migration[5.2]
def change
add_column :kingbehemoths, :user_id, :string
end
end
|
FactoryGirl.define do
factory :user do
sequence(:email) {|n| "email#{n}@gmail.com" }
username "cartman"
first_name "jeez"
last_name "shit"
password "123456"
end
factory :question do
title 'What is this?'
body 'don doodie'
user_id 1
end
end
|
require 'spec_helper'
describe Jobs::TransactionCancellationJob do
before(:each) do
resource_method_is_speced_in_resource_mixin_spec
end
def stub_perform
stub_find(mock_cancellation)
mock_cancellation.stub \
:cancelled? => true,
:transaction => mock_transaction,
:url => 'http://e... |
require 'spec_helper'
describe ServiceManager do
let(:service_name) { 'wordpress' }
let(:image_name) { 'some_image' }
let(:service_description) { 'A wordpress service' }
let(:service_state) do
{
'node' => {
'value' => '{"loadState":"loaded"}'
}
}
end
let(:fake_fleet_client) do... |
require 'conways'
describe Cell do
context "#live?" do
it "returns true when initialized as live" do
cell = Cell.new(:state => :live)
cell.live?.should be_true
end
it "returns false when initialized as dead" do
cell = Cell.new(:state => :dead)
cell.live?.should be_false
end
... |
class AddCommentedUserToNotification < ActiveRecord::Migration[5.0]
def change
add_column :notifications, :commented_user, :string
end
end
|
class Destination < ApplicationRecord
has_many :reviews
validates :city, :presence => true
def self.search(x)
where("city ILIKE ?", "%#{x}%")
end
# scope :search, ->(country) {(
# where("country ilike ?", country )
# )}
end
|
class AddReleaseYearInMovies < ActiveRecord::Migration[6.1]
def change
add_column :movies, :release_year, :integer
end
end
|
Rails.application.routes.draw do
root to: "users#new"
resources :users
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.