text stringlengths 10 2.61M |
|---|
require_relative '../sections/base'
module Utils
class Distribution < ::Sections::Base
attr_reader :context_defaults, :current_section, :element
DISTRIBUTION_TYPES = {
'uniform' => 0x01, 'normal' => 0x02,
'time_infinite' => 0x03
}
DISTRIBUTION_TEMPLATES = {
# type from to
'u... |
class Ingredient < ActionRecord::Base
has_and_belongs_to_many :recipes
end
|
#!/usr/bin/env ruby
require "rubygems"
require "http_client_tools"
require "yaml"
require "pp"
require "tile_engine"
def get_tile ( x,y,z,cfg)
w_x = (cfg["base_extents"]["xmax"] - cfg["base_extents"]["xmin"])/(2.0 **(z.to_f))
w_y = (cfg["base_extents"]["ymax"] - cfg["base_extents"]["ymin"])/(2.0 **(z.to... |
class EnableNannyForTestAccount < ActiveRecord::Migration
SUBDOMAINS = "('test')"
def self.up
Account.update_all("nanny_enabled = true", "subdomain in #{SUBDOMAINS}")
end
def self.down
Account.update_all("nanny_enabled = false", "subdomain in #{SUBDOMAINS}")
end
end
|
namespace :nginx do
%w[start stop restart reload].each do |command|
desc "#{command} nginx"
task command do
on roles :web do
run "sudo service nginx #{command}"
end
end
end
end
|
class Language < ApplicationRecord
has_many :wedding_album_translations
end
|
# frozen_string_literal: true
module Paginatable
private
def apply_pagination(scope, page)
build_pagination_records(scope, page)
end
def build_pagination_records(scope, page)
scope.paginate(page[:number], page[:size])
end
end
|
require 'faraday'
class AmdorenConnectionService
BASE_URL = "https://www.amdoren.com/api/currency.php?api_key=KHKnLD9Ui3XKUmfLwgAT5Qx3fkEWhS".freeze
def self.call(*args)
new(*args).call
end
def initialize(params = {})
@from = params[:from]
@to = params[:to]
@url = params[:url] || BASE_URL
e... |
require "sinatra"
require "sinatra/reloader"
require "sinatra/content_for"
require "tilt/erubis"
configure do
enable :sessions
set :session_secret, 'secret'
set :erb, :escape_html => true
end
before do
session[:payments] ||= []
end
helpers do
# ****-****-****-1111
def hide_card_num(card_num)
string =... |
class AddColumnsToCat < ActiveRecord::Migration[5.2]
def change
add_column :cats, :birth_date, :date
add_column :cats, :color, :string
change_column :cats, :name, :string, null: false
add_column :cats, :sex, :string, limit: 1
add_column :cats, :description, :text
add_index :cats, :name
end
e... |
class Admin::DefinitionsController < Admin::BaseController
before_action :load_definition, except: [:index, :new, :create]
def index
@definitions = Definition.includes(:video_type).order('video_types.name, definitions.name').page(params[:page])
end
def new
@definition = Definition.new
js :edit
e... |
module Bowline
# To be included in classes to allow some basic logging.
module Logging
def trace(msg=nil)
Bowline.logger.info(msg)
end
module_function :trace
public :trace
def debug(msg=nil)
Bowline.logger.debug(msg)
end
module_function :debug
public :debug
... |
class Api::V1::SessionsController < Api::V1::ApiController
skip_before_action :authenticate_user_from_token!
# POST /api/v1/login
def create
@user = User.find_for_database_authentication(email: params[:email])
return invalid_login_attempt unless @user
if @user.valid_password?(params[:password])
... |
# require 'faker'
# FactoryGirl.define do
# factory :vehicle do |f|
# f.client_id 1
# f.device_id 1
# f.vin { Faker::Vehicle.vin }
# f.registration_number { "а#{rand(100..999)}бв#{rand(10..999)}" }
# # association :client
# # association :device
# end
# end
|
# 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... |
RSpec.describe TicTacToeGUI::TicTacToeGUI do
game = TicTacToeGUI::TicTacToeGUI.new
it "has a version number" do
expect(TicTacToeGUI::VERSION).not_to be nil
end
end |
class Users < ActiveRecord::Migration
def change
create_table "users", force: true do |t|
t.string "name"
t.string "email"
t.string "role"
t.datetime "created_at"
t.datetime "updated_at"
t.string "password_digest"
t.string "remember_token"
t.string "avatars"
t... |
types_of_people = 10 #I hv assigned value 10 to the variable name types_of_people
x = "There are #{types_of_people} types of people." #types_of_people value is passed to the string within quotes,also assigned string value to x.
binary = "binary" #simply assigned string value b... |
require 'yaml'
require_relative "board.rb"
class Game
LAYOUTS = {
:small => { :grid_size => 9, :num_bombs => 10 },
:medium => { :grid_size => 16, :num_bombs => 40 },
:large => { :grid_size => 32, :num_bombs => 160 }
}
def initialize(size)
layout = LAYOUTS[size]
@board = Board.new(layout[:gri... |
require 'tax_cloud/response/response_base'
require 'tax_cloud/cart_item_tax'
module TaxCloud
class LookupResponse < ResponseBase
attr_reader :cart_id
def initialize(attrs = {})
@cart_id = attrs[:cart_id]
@raw_cart_items_response = attrs[:cart_items_response]
super
end
def taxes
... |
class CreateGroupMessages < ActiveRecord::Migration[6.1]
def change
create_table :group_messages do |t|
t.string :content, null: false
t.string :added_new_users
t.string :seen_by
t.references :user, index: true, foreign_key: true
t.belongs_to :conversation, index: true
t.times... |
class Stage < ActiveRecord::Base
extend FriendlyId
friendly_id :slug, use: :scoped, scope: :cup
belongs_to :cup
default_scope order(:id)
has_many :matches, include: [:match_participations, :home, :guest]
validates_presence_of :cup_id
def slug
key = name.parameterize
{ "quarterfinal" => "viert... |
# 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 Sudo::LoginController < AdminController
def index
redirect_to root_url if session[:user_id]
@user = User.new
end
def create
@user = User.find_by_email(_login_params[:email])
if @user && @user.password == _login_params[:password]
session[:user... |
class Experience < ApplicationRecord
belongs_to :talent
belongs_to :company_type, optional: true
accepts_nested_attributes_for :talent, :reject_if => :all_blank
accepts_nested_attributes_for :company_type, :reject_if => :all_blank
validates_presence_of :position, message: "Ajoute l'intituler de ton poste", ... |
require 'spec_helper'
describe Friend do
before( :each ) do
@friend = FactoryGirl.build( :friend )
end
context '#name' do
describe "with invalid params" do
it "like nil value" do
@friend.name = nil
@friend.should_not be_valid
@friend.should have(1).errors_on(:name)
... |
ActiveAdmin.register DogPerson do
menu false
form do |f|
person = Person.find(params[:person_id])
label = dog_person.id.present? ? "Editing dog assignment for #{ person.full_name } and #{ dog_person.dog.name }" : "Assign a Dog To #{ person.full_name }"
f.inputs label do
f.input :ownership_type, a... |
# encoding: UTF-8
# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0
module TwitterCldr
module Transforms
class InvalidTransformIdError < StandardError; end
class TransformId
CHAIN = [
:normal_fallback1, :normal_fallback2, :laddered_fallback1,
:normal_fallback... |
class FramesController < ApplicationController
before_filter :authenticate_user!
def index
@user_asset = UserAsset.find(params[:user_asset_id])
# if !(File.exists? "private/frames/#{params[:filename]}_#{params[:offset]}.jpg")
# @frame = Avcrb::FrameRipper.new("private/videos/#{params[:filename]}.#{p... |
class Api::EventsController < Api::BaseController
before_action :authenticate_user!, except: [:show]
def create
# 必须是自己的主题
service = Service.find_by(id: params[:service_id],state: "active")
return render json: {mesasge: "找不到主题"} if service.nil?
return render json: {message: "别人的主题"} if service.user_... |
module DefaultPageContent
extend ActiveSupport::Concern
included do
before_filter :set_page_defaults
end
def set_page_defaults
@page_title = "The Official Portfolio Site of Jackson Green"
@seo_keywords = "Jackson, Green, Portfolio"
end
end |
require_relative 'board'
class Game
attr_accessor :board
def initialize(board = Board.new)
@board = board
end
def over?
if board.full?
return true
else
return false
end
end
def winner
if board.locations == {top: {left: :x, middl... |
class Pricing
def initialize(journey, start_date, end_date)
@journey = journey
@start_date = start_date
@end_date = end_date
end
def number_of_days
(@end_date - @start_date).to_i
end
def base_price
case number_of_days
when 0
0 #89
when 1
0 #119
when 2
0 #169... |
require 'json'
require 'yaml'
require 'fileutils'
require 'pathname'
PathFor = {
root: Pathname.new(__dir__),
package_json: Pathname.new(File.join(__dir__, "package.json" )),
readme: Pathname.new(Fil... |
namespace :db do
namespace :fixtures do
desc 'Creates a init Setting model in database'
task :create_settings => :environment do
setting = Setting.first
if setting == nil
puts '*** Settings is going to be created...'
setting = Setting.new
setting.save
puts '*** Setti... |
class MembershipSweeper < ActionController::Caching::Sweeper
observe Membership
def after_save(membership)
expire_cache_for(membership)
end
def after_destroy(membership)
expire_cache_for(membership)
end
private
def expire_cache_for(membership)
namespaces = User::ROLES.keys - [:guest, :stu... |
# frozen_string_literal: true
require 'rails_helper'
# These tests are skipped if LDAP is not enabled as part of the test suite.
# In order to run these tests set the `ENABLE_LDAP=true` environment variable
# and provide an appropriate LDAP server.
#
# This expects the rroemhild/test-openldap docker image to be runni... |
# Definición de una constante
PI = 3.1416
puts PI
# Definición de una variable local
myString = 'Yo amo mi ciudad, Vigo'
puts myString
=begin
Conversiones
to_i - convierte a número entero
to_f - convierte a número decimal
to_s - convierte a string
=end
var1 = 5
var2 = '2' #fijarse q... |
class QuestionsController < ApplicationController
include Voted
include PublicIndex
include PublicShow
before_action :load_question, only: [:show, :edit, :update, :destroy]
before_action :question_user_compare, only: [:update, :destroy]
authorize_resource
def index
respond_with @questions = Question... |
require 'test_helper'
class ActsAsShareableObjectTest < ActiveSupport::TestCase
fixtures :cars
test "truth" do
assert_kind_of Module, ActsAsShareableObject
end
test "twitter summary card type" do
car = cars(:pagani)
car.stubs(:twitter_card).returns("summary")
assert_equal car.social_meta_pr... |
module ET3
module Test
class EmployersContractClaimPage < BasePage
set_url '/respond/employers_contract_claim'
element :error_header, :error_titled, 'errors.header', exact: true
section :make_employer_contract_claim_question, :single_choice_option, 'questions.make_employer_contract_claim.label... |
require 'application_system_test_case'
class WelcomeTest < ApplicationSystemTestCase
test 'loading the home page' do
# Visit the home page
visit root_url
# Verify that page loaded correctly
assert_selector '.navbar-brand', text: 'HireFlow'
end
end
|
class Response < ActiveRecord::Base
validates :respondent, :answer_choice, presence: true
belongs_to :respondent,
primary_key: :id,
foreign_key: :respondent_id,
class_name: 'User'
belongs_to :answer_choice
has_one :question, through: :answer_choice
validate :author_can_not_respond_to_own_poll
... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
geocoded_by :address
after_validation :geocode, if: ... |
class AddTrashToGame < ActiveRecord::Migration
def change
add_reference :games, :trash, index: true
end
end
|
class Personality < ActiveRecord::Base
# Would have liked to abstract the movie-actor/writer/director relationship here, but ruby will not check if the instances returned here are instances of subclasses to be able to seperate them out for display
has_and_belongs_to_many :movies
end
|
require 'spec_helper'
module Cb
describe Cb::RecommendationApi do
context '.for_job' do
it 'should get recommendations for a job', :vcr => { :cassette_name => 'job/recommendation/for_job' } do
search = Cb.job_search_criteria.location('Atlanta, GA').radius(10).search()
job = search[Random.ne... |
class PtDefect < ActiveRecord::Base
belongs_to :pt
default_scope order(:created_at)
end
|
class FantasyPlayersController < ApplicationController
def index
@fantasy_players = FantasyLeague.
right_joins_fantasy_players(fantasy_league_param).
group_by(&:sports_league_name)
end
private
def fantasy_league_param
params[:fantasy_league_id] || FantasyL... |
# In the below exercises, write code that achieves
# the desired result. To check your work, run this
# file by entering the following command in your terminal:
# `ruby section1/exercises/variables.rb`
# Example: Write code that saves your name to a variable and
# prints what that variable holds to the terminal:
name ... |
class Api::DepartmentsController < Api::ApiController
expose :departments, -> { @active_company.departments }
expose :department, id: ->{ params[:slug] }, scope: ->{ @active_company.departments.includes_associated }, find_by: :slug
# GET api/departments/options
def index
render json: departments.includes_... |
class AddSubscribersToLesson < ActiveRecord::Migration[5.0]
def change
add_column :lessons, :subscribers, :integer, default: 0
end
end
|
module Stack
def self.keystone_admin_env(node)
keystone_auth_url = "http://#{node[:keystone][:private_ip]}:" \
"#{node['keystone']['config']['public_port']}/v2.0"
{ "OS_USERNAME" => "admin",
"OS_PASSWORD" => node[:admin][:password],
"OS_TENANT_NAME" => "admin",
"OS_A... |
require 'spec_helper'
describe "a User signing in" do
before :each do
@user = User.create(email: 'sam@gmail.com', password: 'password', password_confirmation: 'password')
visit new_user_session_path
end
context "when the User exists" do
before :each do
visit new_user_session_path
fill_in 'Email', wit... |
require 'mruby/bindings'
require 'yaml'
module MRuby::Bindings
module CTypes
@types = {}
@destructors = Hash.new { |h, k| h[k] = 'free' }
@skip_functions = {}
class << self
def define(*type_names, &block)
type_names = type_names.flatten
last_definition = nil
type_names.... |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryPr... |
class CreatePixelClusters < ActiveRecord::Migration
def change
create_table :pixel_clusters do |t|
t.integer :user_id
t.column :height, 'smallint unsigned', :default => 0, :null => false
t.column :width, 'smallint unsigned', :default => 0, :null => false
t.column :count, 'smallint unsig... |
require 'test_helper'
class CsvReaderTest < ActiveSupport::TestCase
test "csv reader should parse file" do
csv_reader = CsvReader.new("test/fixtures/files/CPdescarga.txt")
csv_reader.read { |row|
assert row.key?("d_codigo")
assert row.key?("d_asenta")
assert row... |
class ColumnChapter < ActiveRecord::Base
belongs_to :column_book, :foreign_key=>"book_id"
belongs_to :user
has_one :post, :foreign_key=>"from_id", :conditions=>"`from`='column'"
named_scope :published, :conditions=>"draft=0"
validates_presence_of :book_id, :message=>"请选择一个栏目"
validates_presence_of :ti... |
class ModifyPrecisionForAssetsAndLiabilities < ActiveRecord::Migration
def self.up
change_column :assets, :amount, :decimal,:precision =>15, :scale => 4
change_column :liabilities, :amount, :decimal,:precision =>15, :scale => 4
end
def self.down
change_column :assets, :amount, :decimal,:precision =>1... |
require_relative '../../models/application_model'
RSpec.describe ApplicationModel do
class MyModel < ApplicationModel; end
describe '.table_name' do
subject { MyModel.table_name }
it { is_expected.to eq 'my_model' }
end
describe '.all' do
subject { MyModel.all }
before do
allow(YAML).... |
class Product < ActiveRecord::Base
has_many :taxons,
:through => :taxon_items,
:foreign_key => "taxonable_id",
:conditions => "taxonable_type = 'Product'"
end
|
class Admins::BlogsController < ApplicationController
before_action :authenticate_admin!
def new
@blog = Blog.new
@blog.blog_images.build
end
def index
@blogs = Blog.page(params[:page]).per(6)
end
def show
@blog = Blog.find(params[:id])
@comments = @blog.comments.page(params[:page]).p... |
require 'colorize'
require_relative 'colors.rb'
include Colors
class Game
attr_reader :player, :board
attr_accessor :enemy_alive, :health_pack_ground, :karambit_knife_ground
def initialize(game_player, game_board)
@player = game_player
@board = game_board
@enemy_alive = true
@health_pack_ground =... |
require 'date'
require 'rational' unless defined?(Rational)
module TZInfo
# Methods to support different versions of Ruby.
#
# @private
module RubyCoreSupport #:nodoc:
# Returns true if Time on the runtime platform supports Times defined
# by negative 32-bit timestamps, otherwise false.
begin
... |
# coding: utf-8
require 'rails_helper'
require Rails.root.join('config/clock')
class ForTest
include Clockwork
end
describe "clock.rb" do
before do
@for_test = ForTest.new
Task.new(
content: "コンテンツ",
status: "todo",
duedate: Date.yesterday.to_s
).save
@mailer = double(RemindM... |
Rails.application.routes.draw do
# patch '/guests/:id', to: 'guests#show'
get '/guests/add_episode', to: 'guests#add_episode', as: 'add_episode'
patch '/guests/:id', to: 'guests#create_appearance', as: 'create_appearance'
resources :guest_episodes
# For details on the DSL available within this file, see http:... |
# Copyright (c) 2009-2011 VMware, Inc.
require "tmpdir"
require "mongodb_service/mongodb_node"
module VCAP
module Services
module MongoDB
module Util
def fmt_error(e)
"#{e}: [#{e.backtrace.join(" | ")}]"
end
def make_logger
return @logger if @logger
@l... |
module NNTP
class Client
# GROUP
#
# Changes the currently selected newsgroup.
#
# === Example
# NNTP::Client.start('your.nntp.server') do |nntp|
# response = nntp.group('comp.lang.ruby')
# end
#
# === Parameters
# +newsgroup+ is the newsgroup to change to.
... |
require 'rails_helper'
RSpec.describe Client, type: :model do
let(:user_number) { 'fake_user_number' }
let(:client_number) { 'fake_client_number' }
let(:department_number) { 'fake_department_number' }
describe 'relationships' do
it { should have_many(:users).through(:reporting_relationships) }
it { sh... |
require 'rails_helper'
include Helpers
describe "Beers page" do
let!(:brewery) { FactoryBot.create :brewery, name:"Koff" }
it "creates new beer with valid name correctly" do
user = FactoryBot.create(:user)
sign_in(username: "Pekka", password: "Foobar1")
visit new_beer_path
fill_in('beer_name', w... |
require 'test_helper'
class PlantingTest < ActiveSupport::TestCase
setup do
@planting = plantings( :one )
@adoption_request = adoption_requests( :one )
@tree = trees( :one )
@note = notes( :one )
end
describe "most_recent_maintenance_record method" do
it "returns the most recent, non-deleted... |
require 'rails_helper'
RSpec.describe Image, type: :model do
describe '#random_string' do
before(:all) do
@image = Image.new
end
it 'должно генерировать значение размером 20 символов (10 hex байтов)' do
expect(@image.random_string.length).to eq(20)
end
it 'должно генерировать для од... |
class CreateAccessReports < ActiveRecord::Migration
def change
create_table :access_reports do |t|
t.string :email
t.string :provider
t.datetime :access_at
t.string :access_ip
end
end
end
|
class PullRequestSubtask < ActiveRecord::Base
belongs_to :pull_request
validates :description, :length => { :maximum => Settings.max_text_field_size }, :presence => true
end
|
module Jekyll
module DatesFr
MONTHS = {"01" => "janvier", "02" => "février", "03" => "mars",
"04" => "avril", "05" => "mai", "06" => "juin",
"07" => "juillet", "08" => "août", "09" => "septembre",
"10" => "octobre", "11" => "novembre", "12" => "décembre"}
... |
class RenameInterpretationToFormulation < ActiveRecord::Migration[6.0]
def change
rename_table :interpretations, :formulations
rename_column :interpretation_aliases, :interpretation_id, :formulation_id
end
end
|
class AddCommentsAndUpvotesToPosts < ActiveRecord::Migration
def change
add_column :posts, :comments_count, :integer, :default => 0
add_column :posts, :upvotes_count, :integer, :default => 0
Post.reset_column_information
Post.find_each do |p|
Post.reset_counters p.id, :comments
Post.r... |
class Generator
@@list = []
attr_accessor :name, :question, :default_answer
def initialize(name, question, default_answer = "")
@@list << self
@name, @question, @default_answer = name, question, default_answer
end
def self.[](name, question, default_answer = "")
g = new(name, question, default_... |
gem 'minitest'
require './lib/player'
require 'minitest/autorun'
require 'minitest/pride'
class PlayerTest < Minitest::Test
def setup
@player1 = Player.new("Max")
@player2 = Player.new("Claire")
@scrabble = Scrabble.new
end
def test_it_exists
assert Player
end
def test_the_total_score_defa... |
require_relative './abstract_e_matrix_storage.rb'
class TridiagonalEMatrixStorage < AbstractEMatrixStorage
attr_accessor :values
def initialize(*args)
# -- Pre Conditions -- #
# See Superclass for more.
if(args.size == 1)
#Must be square
assert(args[0].size == args[0][0].size)
... |
require 'xmlpipes/strategies/simple.rb'
describe XMLPipes::Strategies::Simple do
before(:all) do
@index = Article.sphinx_pipes.first
@source = @index.sources.first
end
before(:each) do
Article.stub!(:indexer).and_return(@indexer = mock(:indexer))
end
describe '#update_attributes' do
it 'a... |
require 'test_helper'
class DownloadTest < Test::Unit::TestCase
# extend general setup mehtod
def setup
super
@file = 'https://rapidshare.com/files/829628035/HornyRhinos.jpg'
@downloader = Rapidshare::Download.new(@file, @rs)
end
context "initialize method" do
should "enable overriding... |
class Member < ApplicationRecord
has_many :users
has_many :customers
has_many :accounts, as: :core_acc
has_many :services, through: :accounts
end
|
module NRL
# Encapsulates an NRL team.
#
# @!attribute id
# @return [Integer] a unique team identifier
# @!attribute full_name
# @return [String] the team's full name
# @!attribute name
# @return [String] the team's shortened name
# @!attribute short_name
# @return [String] three-letter abbr... |
class PersonManager
def initialize store
@store = store
@persons = store.read
end
def save_persons
@store.write(@persons)
end
def add(person)
@persons[person.id] = person
end
def remove(id)
@persons.delete(id)
end
def persons
@persons.dup
end
def find_by_id(id)
@persons[id]
end
def max... |
#!/usr/bin/env ruby
# file: rpi_photocell.rb
require 'mcp3008pi'
# To use this gem you will need the following:
#
# * a Raspberry Pi
# * an MCP3008 10-bit Analog-to-Digital Converter (ADC)
# * a Photoresistor https://en.wikipedia.org/wiki/Photoresistor
class RPiPhotocell < Mcp3008Pi
def initialize(pin: 0, cloc... |
class Challenge < ActiveRecord::Base
has_many :pictures
belongs_to :author, class_name: "User"
has_and_belongs_to_many :users
after_create :set_closing_date
validates :title, presence: true
validates :author, presence: true
def set_closing_date
if self.is_hour_challenge?
self.update_attribute(:closing_dat... |
require 'rails_helper'
describe "the adding a message process" do
it "allows a visitor the ability to add a message for a user" do
user = FactoryGirl.create(:user)
visit "/#{user.username}"
fill_in 'message_body', with: "Yo! Whazzzzup!"
click_button 'Submit'
expect(page).to have_content 'Message... |
feature 'Monitoring the results' do
before do
allow(Kernel).to receive(:rand).and_return(2)
end
feature 'Declaring the round result'do
scenario 'Declares rock beats scissors' do
sign_in_and_play
click_button('Rock')
click_button('Outcome')
expect(page).to have_content "Ed won thi... |
module PrintCredit
extend ActiveSupport::Concern
include PrintHeader
include PrintCustomerDetail
include PrintFooter
include PrintTable
include PrintFooter
include PrintPageNumbers
include PrintCreditHeader
include PrintCreditDetail
include PrintCreditTabl... |
require 'rails_helper'
RSpec.describe RegistrationsController, type: :controller do
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
let(:valid_session) { {} }
... |
module Types
class GeojsonFeatureType < Types::BaseObject
field :type, String, null: false
field :id, ID, null: false
field :geometry, Types::GeojsonGeometryType, null: false
field :properties, Types::LocationType, null: false
end
end
|
class TrelloFetcher
def boards
get('/organizations/assembly4/boards')
end
def actions(board_id:, since:, before: Time.now)
actions = get("/boards/#{board_id}/actions", {
filter: [ 'addAttachmentToCard',
'addChecklistToCard',
'addMemberToCard',
'comme... |
class CreateDatProjectlogs < ActiveRecord::Migration
def self.up
create_table :dat_projectlogs do |t|
t.integer "projectcomp_id", :null => false
t.integer "log_kbn", :null => false
t.integer "create_user_id", :null => false
t.datetime "created_on", :null => false
end
en... |
require 'parslet'
require_relative 'nodes/number'
require_relative 'nodes/variable'
require_relative 'nodes/assign'
require_relative 'nodes/function'
require_relative 'nodes/call'
require_relative 'nodes/maybe'
# The transform step takes the tree-like output from the parser and
# converts it into a more useful form. I... |
Rails.application.routes.draw do
devise_for :users
root 'static_pages#root'
resources :users
end
|
require 'spec_helper'
describe Student do
let(:unamed_student) { Student.new(email: "alicebob@example.com", age: 30, favorite_ice_cream_flavor: 'vanilla') }
let(:named_student) { Student.new(full_name: "Alice Bob")}
context "testing isolated ice cream flavor validation" do
before :each do
@student =... |
# 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 bin/rails db:seed commands (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
#... |
class Client < ActiveRecord::Base
audited
attr_accessor :step, :delete_logo, :delete_stamp
before_validation { logo.clear if delete_logo == '1' }
before_validation { stamp.clear if delete_stamp == '1' }
before_validation :delete_from_branchs
has_one :client_segment, :validate => false, dependent: :destroy
acc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.