text stringlengths 10 2.61M |
|---|
require 'spec_helper'
describe 'java::default' do
let(:chef_run) do
runner = ChefSpec::ChefRunner.new(
:platform => 'debian',
:version => '7.0'
)
runner.converge('java::default')
end
it 'should include the openjdk recipe by default' do
expect(chef_run).to include_recipe('java::openjdk... |
require 'test_helper'
class ChefsEditTest < ActionDispatch::IntegrationTest
def setup
@chef = Chef.create!(chefname: 'Giuseppe', email: 'giuseppe@example.com',
password: "password", password_confirmation: "password")
@chef2 = Chef.create!(chefname: 'Pluto', email: 'pluto@example.com',... |
require 'spec_helper'
describe CategoriesController do
describe "GET index" do
it "should be successful" do
get 'index'
response.should be_success
end
it "assigns all categorys as @categorys" do
category = FactoryGirl.create(:category)
get :index
assigns(:categories).s... |
class Role < ActiveRecord::Base
has_many :role_assignments
has_many :welcomers, through: :role_assignments
end
|
# frozen_string_literal: true
require "test_helper"
class SamsungBrowserTest < Minitest::Test
test "detects samsung browser" do
browser = Browser.new(Browser["SAMSUNG_BROWSER"])
assert browser.webkit?
assert browser.samsung_browser?
assert_equal "11", browser.version
assert_equal :samsung_brows... |
module Tokenizer
class Lexer
module TokenLexers
# rubocop:disable Layout/MultilineOperationIndentation
def comp_2_gt?(chunk)
chunk =~ /\A(大|おお)きければ\z/ ||
chunk =~ /\A(長|なが)ければ\z/ ||
chunk =~ /\A(高|たか)ければ\z/ ||
chunk =~ /\A(多|おお)ければ\z/ ||
false
end
... |
# encoding: utf-8
require 'mongoid'
require 'coderay'
require 'colorize'
module MongoidColors::Colorizer
def self.setup
return unless Mongoid.logger
old_formatter = Mongoid.logger.formatter
Mongoid.logger.formatter = lambda do |severity, datetime, progname, msg|
m = parse(msg)
return if m =... |
require 'bigdecimal'
class Store
attr_reader :name,
:address,
:type,
:inventory_record
def initialize(name, address, type)
@name = name
@address = address
@type = type
@inventory_record = []
end
def add_inventory(inventory)
@inventory_record << i... |
require File.expand_path("../../../../../base", __FILE__)
require Vagrant.source_root.join("plugins/guests/windows/cap/change_host_name")
describe "VagrantPlugins::GuestWindows::Cap::ChangeHostName" do
let(:described_class) do
VagrantPlugins::GuestWindows::Plugin.components.guest_capabilities[:windows].get(:cha... |
# Public: Tells if a string is empty or not.
#
# string - The String that might be empty.
#
# Examples
#
# is_empty("Tjo!")
# # => false
#
# Returns if the string is empty or not.
|
class Team < ActiveRecord::Base
has_many :players
belongs_to :game
belongs_to :division
before_save :downcase_name
validates :name, :presence => true
private
def downcase_name
self.name = self.name.downcase
end
scope :black, -> { where( color: 'black' ) }
end |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe RelatedProduct, type: :model do
it { should belong_to(:product) }
it { should belong_to(:related) }
end
|
class SearchController < ApplicationController
protect_from_forgery except: :search
skip_authorization_check
def search
@search_results = SphinxSearch.search_results(params[:search_text]) if params[:search_text]
end
end
|
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler'
require 'shellwords'
require 'appscript'
require 'slop'
DEBUG = false
class Host
attr_reader :name, :login
def initialize(name, login = ENV['USER'])
@name = name
@login = login
end
end
class Terminal
include Appscript
attr_reader :terminal, ... |
require 'spec_helper'
describe SuperRole::ActionAlias do
describe '.create' do
context 'when the alias does not exist' do
it 'should create a new instance of ActionAlias for each resource_types' do
expect do
SuperRole::ActionAlias.create(['delete', 'remove'], 'destroy', ['Project', 'Us... |
class CreateBudgetSourcesProjectsJoin < ActiveRecord::Migration
def up
create_table :budget_sources_projects , :id => false do |t|
t.integer "project_id"
t.integer "budget_source_id"
end
end
def down
end
end
|
class Producer::ApplicationsController < ApplicationController
def show
@application = Application.find(params["format"])
end
def new
@design = Design.find(params["format"])
@application = Application.new
end
def create
if current_producer?
design = Design.find(params[:design_id])
... |
Pod::Spec.new do |s|
s.name = "DPWebViewLocalCache"
s.version = "1.1.7"
s.ios.deployment_target = '7.0'
s.summary = "A delightful setting interface framework."
s.homepage = "https://github.com/xiayuqingfeng/DPWebViewLocalCache"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author ... |
require 'rails_helper'
RSpec.describe User, type: :model do
describe 'Validations' do
before(:all) do
@existingUser = User.create(:email => 'hello@example.com', :password => 'password', :password_confirmation => 'password')
end
it 'should contain name,email and matching password and password confi... |
require 'csv'
namespace :checkins do
desc "Backfill deltas on weights"
task backfill_deltas: :environment do
Checkin.find_each do |c|
previous_checkin = Checkin.where(person: c.person, event: c.event).where('created_at < ?', c.created_at).last
if previous_checkin
delta = c.weight - previous... |
#
# オープンクラスのテスト
# 自分でeachメソッドを用意してみる
# イテレータは"whileキーワードを使った列挙"という動作のラッパに過ぎないと分かる
#
class Array
def my_each
#block_given = ブロックの有無
return nil unless block_given?
count = 0
limit = self.length
while count < limit do
# yieldでブロックに評価させたいのはselfの個別の値
yield(self[count])
count... |
class AddPotentialProductAnswersIndices < ActiveRecord::Migration
def self.up
add_index :potential_product_answers, [:category_id], :name => 'category_id_idx'
add_index :potential_product_answers, [:category_id, :covary_group], :name => 'category_id_covary_group_idx'
end
def self.down
remove_i... |
require 'sinatra/base'
require 'twitter'
require 'mongo'
require 'erb'
require 'twitter'
require 'oauth'
require_relative 'helpers'
$temp_table = $db_client[:temp]
# # Load Twitter app info into a hash called `config` from the environment variables assigned during setup
# # See the "Running the app" section of the RE... |
class AddMmrToMatches < ActiveRecord::Migration
def change
add_column :matches, :mmr, :decimal,precision: 10, scale: 6
end
end
|
class AddBedsToRealEstates < ActiveRecord::Migration[5.0]
def change
add_column :real_estates, :beds, :integer
end
end
|
class Path
attr_reader :folder_name
def initialize(folder_name)
@folder_name = folder_name
end
def get
Dir.home.to_s + "/" + folder_name.to_s
end
end
|
class RenamePenaltyToPenaltiesInScorecards < ActiveRecord::Migration
def change
rename_column :scorecards, :penalty, :penalties
end
end
|
FactoryGirl.define do
factory :event, class: Event do
title "Seminario"
date Time.zone.now
description "Seminario en centro Banamex"
# picture "picture"
picture_file_name 'picture.jpg'
picture_content_type 'image/jpeg'
picture_file_size 1.megabyte
event_type "seminar"
trait :conve... |
FactoryBot.define do
factory :match_score do
association :match
association :player
association :beatmap
transient do
full_combo? { false }
end
max_combo { full_combo? ? beatmap.max_combo : rand(beatmap.max_combo) }
count_300 { rand(max_combo) }
count_100 { rand(max_combo - cou... |
class AddPhoneToClients < ActiveRecord::Migration
def change
add_column :clients, :phone, :integer
end
end
|
require 'fileutils'
$phpmyadmin_version = "3.4"
$phpmyadmin_cart_root = "/usr/libexec/stickshift/cartridges/embedded/phpmyadmin-#{$phpmyadmin_version}"
$phpmyadmin_hooks = $phpmyadmin_cart_root + "/info/hooks"
$phpmyadmin_config = $phpmyadmin_hooks + "/configure"
$phpmyadmin_config_format = "#{$phpmyadmin_config} %s %... |
class AddUniqueReputableBadgingsIndex < ActiveRecord::Migration
def self.up
execute "ALTER IGNORE TABLE `reputable_badgings` ADD UNIQUE INDEX `index_reputable_badgings_on_user_id_and_badge_id_and_year` (`user_id`,`badge_id`,`year`);"
end
def self.down
execute "DROP INDEX index_reputable_badgings_on... |
$depth = 0
def better_log desc, &block
depth = ' '*$depth
puts depth + "Beginning \"#{desc}\"..."
$depth += 1
result = block[]
$depth -= 1
puts depth + "...\"#{desc}\" finished, returning: #{result}"
end
better_log 'outer block' do
better_log 'some little block' do
better_log 'teeny-tiny block' do
... |
class PulseOptions
ONE_HOUR_IN_SECONDS = 3600
DEFAULT_TIMEOUT_IN_HOURS = 10
DEFAULT_POLLING_TIME_IN_SECONDS = 60
DEFAULT_TOKEN_REFRESH_TIME_IN_SECONDS = 1200
DEFAULT_BUILD_REQUEST_TIME_IN_SECONDS = 60 * 20
CONCOURSE_URL = "https://gpdb.data.pivotal.ci/"
attr_reader :url, :project_name, :username, :passw... |
class Question < ActiveRecord::Base
belongs_to :shopper, class_name: "User", foreign_key: :shopper_id
has_many :question_images
has_many :question_friends
end
|
require "rails_helper"
RSpec.describe AppController, type: :routing do
describe "routing" do
it "routes to #create" do
expect(:post => "/user_contacts").to route_to("user_contacts#create")
end
end
end |
class ChangeFieldsOnContentsAndCategories < ActiveRecord::Migration
def change
add_column :categories,:background_image,:text
remove_column :contents, :image_url
remove_column :contents, :content_type
remove_column :contents, :order
end
end
|
class User < ApplicationRecord
has_many :private_messages
has_many :gossips
has_many :comment
has_many :likes
has_many :tags
belongs_to :city
end
|
class LinkBinariesToClient < ActiveRecord::Migration
def up
add_column :binaries, :client_id, :integer
end
def down
remove_column :binaries, :client_id
end
end
|
class TicTacToe
def initialize(board = nil)
@board = board || Array.new(9, " ")
end
WIN_COMBINATIONS = [
[0,1,2],
[3,4,5],
[6,7,8],
[0,3,6],
[1,4,7],
[2,5,8],
[0,4,8],
[6,4,2]
]
def display_board
puts " #{@board[0]} | #{@board[1]} | #{@board[2]} "
puts "-----------"
puts " #{@board[3... |
# frozen_string_literal: true
require "benchmark"
namespace :diaverum do
namespace :db do
namespace :demo do
desc "Loads demo seeds from renalware-core then adds renalware-diaverum demo seeds"
task seed: :environment do
if Rails.env.development?
require Renalware::Diaverum::Engine.... |
class BoardTraversal
attr_reader :current, :moves_registered, :unprocessed_queue, :solved_states
def initialize(target_board)
@current = target_board
@moves_registered, @unprocessed_queue = [], []
@solved_states = {}
end
end
|
module SportsSouth
class Image < Base
API_URL = 'http://webservices.theshootingwarehouse.com/smart/images.asmx'
def self.urls(item_number, options = {})
requires!(options, :username, :password)
http, request = get_http_and_request(API_URL, '/GetPictureURLs')
request.set_form_data(form_pa... |
FactoryBot.define do
factory :related_file_group_join do
association :source_file_group, factory: :external_file_group
association :target_file_group, factory: :bit_level_file_group
end
end |
# Take two parameters of beginning and ending of range (inclusive),
# and return sum of all even numbers in range.
def sum_even_nums_in_range(start, stop)
(start..stop).select(&:even?).sum
end
|
#Navigate to google.co.uk
Given(/^I am on the Google homepage$/) do
visit 'https://www.google.co.uk/'
end
#Write "yahoo" search text to the search bar
When(/^I will search for "([fusion_builder_container hundred_percent="yes" overflow="visible"][fusion_builder_row][fusion_builder_column type="1_1" background_positi... |
require 'calabash-android/calabash_steps'
Given(/^I am on the landing screen$/) do
check_element_exists "* id:'toolbar' * {text CONTAINS 'Calabash Issue #707'}"
end
When(/^I click the first photo on the screen$/) do
touch "* id:'image_view' index:0"
end
Then(/^I see a new screen that says "([^"]*)"$/) do |arg|
... |
module Eq
module RoleAssignments
# Eq::RoleAssignments::RoleAssignmentEntityFactory
class RoleAssignmentEntityFactory
def build(hash)
RoleAssignmentEntity.new(
id: hash[:id],
user: hash[:user],
target: hash[:target],
role: hash[:role],
assigner: ... |
class UserMailer < ApplicationMailer
default from: 'ajesteves@gmail.com'
def welcome_mail
@url = 'http://example.com/login'
mail(to: "ajesteves@gmail.com", subject: 'Welcome to My Awesome Site')
end
end
|
class FavoritesController < ApplicationController
load_and_authorize_resource
# GET /users/:user_id/favorites
def index
render json: @favorites
end
# GET /favorites/1
def show
render json: @favorite
end
# POST /users/:user_id/favorites
def create
if @favorite.save
render json: @fa... |
module CzechName
class NameFactory
attr_reader :raw, :parsed
def initialize(name)
@raw = name
@parsed = @raw && @raw.split(' ')
end
def create
return nil if raw.nil? || raw.empty?
case
when any_name_is_female_first? then create_female_name
when all_names_are_fema... |
# The class Computer acts as an interface
class Computer
def Clone
raise NotImplementedError, 'CLone() must be defined in subclass'
end
end
# The class Laptop1 inherits from Computer
class Laptop1 < Computer
def Clone
return self.clone
end
def Functionality
puts "Laptop 1"
... |
class User < ActiveRecord::Base
has_secure_password
has_many :adventurers
validates :username, :name, presence: true
validates :username, uniqueness: true
# def randomize
# Adventurer.create(
# name: [Faker::FunnyName.two_word_name, Faker::FunnyName.three_word_name, Faker:... |
# frozen_string_literal: true
# rubocop:todo all
require 'spec_helper'
describe 'awaited hello' do
min_server_fcv '4.4'
# If we send the consecutive hello commands to different mongoses,
# they have different process ids, and so the awaited one would return
# immediately.
require_no_multi_mongos
let(:cl... |
# Author:: Tor E Hagemann <hagemt@rpi.edu>
# Copyright:: Copyright (c) 2012 onetooneandonto
require 'rubygems'
require 'dm-core'
# Buzzline Model
module Buzzline
class Buzzline
include DataMapper::Resource
property :id, Serial
property :date, String
property :email, String
property :who, String
prope... |
class CreateInfractions < ActiveRecord::Migration
def change
create_table :infractions do |t|
t.string :owner_name
t.string :owner_identifier
t.string :owner_zip_code
t.string :owner_address
t.string :owner_address_number
t.string :owner_address_complement
t.string :owner... |
class Function < ActiveRecord::Base
has_many :business_unit_functions
has_many :business_units, through: :business_unit_functions
has_many :function_cost_centers
has_many :cost_centers, through: :function_cost_centers
end
|
json.array!(@slbigforms) do |slbigform|
json.extract! slbigform, :id, :first_name, :second_name, :date_of_birth, :sex, :edu, :about, :music, :phone, :email, :photo, :site, :agree
json.url slbigform_url(slbigform, format: :json)
end
|
class ProductsController < ApplicationController
def index
@products = Product.all.paginate(:page => params[:page], :per_page => 9)
end
def usa
@usa_products = Product.made_in_usa
end
def most_reviews
@most_reviews_products = Product.most_reviews
end
def most_recent
@most_recent_produc... |
class RenameExplanationColumnToDeals < ActiveRecord::Migration
def change
rename_column :deals, :explanation, :deal_detail
end
end
|
# frozen_string_literal: true
# Unit of measurement
class Unit < ApplicationRecord
has_many :range_parameters, dependent: :delete_all
has_many :integer_parameters, dependent: :delete_all
validates :name, :short, presence: true
end
|
require 'rails_helper'
RSpec.describe "investigationclassifications/show", type: :view do
before(:each) do
@investigationclassification = assign(:investigationclassification, Investigationclassification.create!(
investigation: nil,
subclassification: nil
))
end
it "renders attributes in <p>"... |
class BookController < ApplicationController
skip_before_action :verify_authenticity_token
def create
@book = Book.new(book_params)
if @book.save
render json: {status: '200 OK', data: @book}
else
render json: {status: '400 Bad Request', data: @book.errors}
... |
#encoding utf-8
namespace :foowcn do
desc "add foowable stores to foowcn, or remove unfoowable stores from foowcn"
task :add_foowable_stores => :environment do
foowcn = Instance.find_by_name 'foowcn'
Store.all.each do |store|
foowcn.stores << store if !foowcn.stores.include?(store) && store.foowab... |
class AddCometitionToSeason < ActiveRecord::Migration[5.1]
def change
add_reference :seasons, :competition, foreign_key: true
end
end
|
class AddOmniauthFirstTime < ActiveRecord::Migration
def change
add_column :users, :first_time_omniauth, :integer
end
end
|
module HumanLogic
def request_guess
"#{current_player.name}: Make your guess! Choose four of the following colors: #{board.colors}"
end
def get_human_guess #NEED TO CHECK FOR VALID INPUT
puts "First color:"
first_color = gets.chomp
puts "Second color:"
second_color = gets.chomp
puts "Thi... |
Gem::Specification.new do |s|
s.name = 'optics-agent'
s.version = '0.5.5'
s.summary = "An Agent for Apollo Optics"
s.description = "An Agent for Apollo Optics, http://optics.apollodata.com"
s.authors = ["Meteor Development Group"]
s.email = 'vendor+optics@meteor.com'
s.files ... |
require 'test_helper'
class ItemsControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
def setup
@item = Item.new
end
test "Create Item" do
get :create
assert_response :success
end
test "New Item" do
get :new
assert_response :success
end
te... |
require "pry"
require_relative "./ConvertPosition"
require_relative "./ConvertPieces"
require_relative "./WriteFile"
require_relative "./Pieces"
require_relative "./Grid"
require_relative "./Moves"
class Game
include ConvertPosition
include ConvertPieces
include WriteFile
def initialize
@board = Grid.new.grid
... |
##
# 제일 작은 수 제거하기
# 문제 설명
# 정수를 저장한 배열, arr 에서 가장 작은 수를 제거한 배열을 리턴하는 함수, solution을 완성해주세요. 단, 리턴하려는 배열이 빈 배열인 경우엔 배열에 -1을 채워 리턴하세요. 예를들어 arr이 [4,3,2,1]인 경우는 [4,3,2]를 리턴 하고, [10]면 [-1]을 리턴 합니다.
#
# 제한 조건
# arr은 길이 1 이상인 배열입니다.
# 인덱스 i, j에 대해 i ≠ j이면 arr[i] ≠ arr[j] 입니다.
# 입출력 예
# arr return
# [4,3,2,1] [4,3,2]
# [10] [-... |
require 'random-port'
require 'rack'
require 'et_azure_insights/adapters/rack'
# A shared context for managing multiple rack servers.
# This will start all servers registered before the context and
# stop them after the context.
# Access to the base_url is available using rack_servers.base_url_for(key)
#
# @example
#
#... |
class HomeController < ApplicationController
def index
if current_user.has_any_role? Role.super_role, Role.admin_role
redirect_to events_path
elsif current_user.has_role? Role.receptionist_role
redirect_to work_center_events_path(current_user&.receptionist&.work_center)
elsif current_user.has... |
module Faceter
module Nodes
# The node describes adding prefix from tuples' keys
#
# @api private
#
class AddPrefix < ChangePrefix
private
def __operation__
:add_prefix
end
end # class AddPrefix
end # module Nodes
end # module Faceter
|
class AddLanguageToArticles < ActiveRecord::Migration
def change
add_column :articles, :language, :string, limit: 10
end
end
|
# == Schema Information
#
# Table name: module_instances
#
# id :integer not null, primary key
# created_at :datetime not null
# updated_at :datetime not null
# module_template_id :integer
# cell_id :integer
# amount :float
# name ... |
class CreateCoursesCategories < ActiveRecord::Migration[5.1]
def change
create_table :categories_courses do |t|
t.integer:course_id, null: false
t.integer:category_id, null: false
end
end
end
|
require_relative './stack.rb'
# Time Complexity: O(n), push and pop should be O(1) operations since the linked list has both a head and tail pointer
# Space Complexity: O(n) if the string is not balanced and comprised wholly of open brackets, also O(n) if it actually closes
def balanced(string)
return false if strin... |
module ChapterExtension
def format_publish_message(story, options={})
if options[:success]
if story.published
data = {
button: I18n.t('actions.unpublish'),
message: I18n.t('actions.publish_success')
}
else
data = {
button: I18n.t('actions.publish')... |
module Vhod
module Config
REPOSITORY_BASE = '/opt/vhod/repositories/'
SVN_BASE = 'svn://vhod/'
REPOSITORY_LAYOUT = ['root']
MIN_LOG_MESSAGE_LENGTH = 2
VHOD_PATH = '/opt/vhod/webapp/current'
end
end
|
require 'test/unit'
require 'network'
class TestNetwork < Test::Unit::TestCase
def setup
@nn = NeuralNetwork.new("test")
@l = NetworkLayer.new(2)
end
def test_push_input_layer
assert_raise ArgumentError do
@nn.pushInputLayer
end
assert(true, @nn.pushInputLayer(@l))
end
def te... |
class Youth < ActiveRecord::Base
has_one :youth_room_assignment
belongs_to :member_type
belongs_to :family
validates_presence_of :family_id
validates_presence_of :member_type_id
validates_presence_of :first_name
validates_presence_of :family_name
validates_presence_of :gender
validates_presence_of :... |
# frozen_string_literal: true
# rubocop:todo all
# Copyright (C) 2014-2020 MongoDB 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
#
# U... |
class ToggleCallQualityIssueMutation < Types::BaseMutation
description "Toggles whether a user reported call quality issues"
argument :call_id, ID, required: true
field :call, Outputs::CallType, null: true
field :errors, resolver: Resolvers::Error
policy ApplicationPolicy, :logged_in?
policy CallPolicy, ... |
CLEAR = %x{clear}
class Calculator
def initialize
print CLEAR
@message = puts " This program is a calculator emulator. Your options for
functions are: ADD - to add two numbers, SUBTRACT - to subtract
the first number from the second, SUM - to add multiple numbers,
MULTIPLY - to multiply any amount of numbers to... |
require 'spec_helper'
describe BalloonsController do
let(:balloon) { Balloon.create!(name: 'Ted') }
subject { response }
describe 'GET #index' do
it 'does not break' do
get :index
expect(response).to be_success
end
end
describe 'GET #new' do
before do
get :new
end
it... |
Rails.application.routes.draw do
get 'airports/show'
get 'countries/index'
get 'airlines/index'
get 'claims/index'
get 'claims/create'
get 'claims/new'
get 'claims/edit'
get 'claims/show'
get 'claims/update'
get 'claims/destroy'
get 'claims/letter/:id', to: 'claims#letter', as: 'claims_le... |
# encoding: UTF-8
require 'rubygems'
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rake'
require 'rake/rdoctask'
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
Rake::RDocTask.new(:rd... |
class Thor
module Actions
# Injects the given content into a file. Different from append_file,
# prepend_file and gsub_file, this method is reversible. By this reason,
# the flag can only be strings. gsub_file is your friend if you need to
# deal with more complex cases.
#
# ==== Parameters
... |
module ChainReactor::Parsers
# Parse the string using the xml simple library.
class XmlSimpleParser < Parser
require 'xmlsimple'
# Parse an XML string, returning the result as a hash.
#
# Raises a ParseError on failure.
def do_parse(string)
begin
@log.debug { "Parsing XML str... |
class Event < ApplicationRecord
belongs_to :user
before_save do
if event_is_free?
self.price = 0
end
end
validates_presence_of :title, :status, :description
validates :price, absence: {message: "must be empty if event is free please" }, if: :event_is_free?
def even... |
class AddProductToOrderProduct < ActiveRecord::Migration[5.0]
def change
add_reference :order_products, :product, foreign_key: true
end
end
|
require 'optparse'
require 'ostruct'
require 'helpers'
class Options < OpenStruct
def initialize
super
defaults
parse
end
private
def defaults
self.proto = 'http'
self.host = 'localhost'
self.port = 8080
self.user = 'admin'
self.passwd = 'admin'
self.out... |
require 'rails_helper'
RSpec.describe "comment_accounts/new", type: :view do
before(:each) do
assign(:comment_account, CommentAccount.new(
:owner_id => 1
))
end
it "renders new comment_account form" do
render
assert_select "form[action=?][method=?]", comment_accounts_path, "post" do
... |
class Critter
attr_accessor :attack, :evade, :health, :damage, :name, :alive
def fight(other_critter)
my_attack = Dice.roll + self.attack
their_evade = Dice.roll + other_critter.evade
if my_attack >= their_evade
current_damage = self.damage
if current_damage < 1
current_damage =... |
Recaptcha.configure do |config|
config.public_key = ENV["RECAPTCHA_PUBLIC"]
config.private_key = ENV["RECAPTCHA_PRIVATE"]
config.proxy = "http://brymck.herokuapp.com"
end
|
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# name :string(255)
# email :string(255)
# gender_id :string(255)
# created_at :datetime
# updated_at :datetime
# modelling_agency :string(255)
# phone_number ... |
module Helpstation
module Processors
# Helps to run processors in parallel
#
# All output from the processors are merged and then returned. This means
# that if two fetchers return results with the same key then one will
# overwrite the other.
#
# @example
# process ParallelProcessor... |
class AddAnnounceCallAgentsToAutomaticCallDistributors < ActiveRecord::Migration
def change
add_column :automatic_call_distributors, :announce_call_agents, :boolean
end
end
|
require 'test_helper'
describe 'Stat' do
describe 'relations' do
it 'has_one season through season stat' do
create :season_stat
stat = Stat.first
season = Season.first
Stat.count.must_equal 1
Season.count.must_equal 1
stat.season.must_equal season
end
it 'has_one pla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.