text stringlengths 10 2.61M |
|---|
module FlipTheSwitch
module Generator
class Base
def initialize(output, feature_states)
@output = output
@feature_states = feature_states
end
protected
attr_reader :output, :feature_states
end
end
end
|
class AddManufacturerReferenceToCars < ActiveRecord::Migration[6.0]
def change
add_foreign_key :cars, :manufacturers
add_index :cars, :manufacturer_id
change_column_null :cars, :manufacturer_id, false
end
end
|
FactoryGirl.define do
factory :address do
street 'R. das Amoreiras'
number 110
neighborhood 'Jardim'
zipcode '09090770'
city
end
end
|
Pod::Spec.new do |s|
s.name = "SGActionView"
s.version = "0.0.1"
s.summary = "SGAction View"
s.homepage = "http://"
s.author = { "Sagi" => "sagiwei@gmail.com"}
s.platform = :ios, '5.0'
s.source = { :git => "https://github.com/sagiwei/SGActionView.git", :branch => "master" }
s.source_files = "SGActionVie... |
class Event < ApplicationRecord
belongs_to :recurring_event
after_create :calculate_next_delivery_date
def calculate_next_delivery_date
next_date = NextEvent.new(self, RecurringEvent.find(self.recurring_event_id)).calculate_next_delivery
self.next_delivery_date = next_date
self.save && schedule_backg... |
class DownloadFoldersController < ApplicationController
before_filter :load_club
before_filter :auth_admin, :only => [:admin, :new, :edit, :create, :update, :destroy]
# GET /download_folders
# GET /download_folders.xml
def index
@download_folders = @club.download_folders
@page_title = "Down... |
namespace :stripe do
desc 'Backfill stripe metadata with repo information'
task backfill_metadata: :environment do
UpdateStripeMetadata.run
end
end
|
require "rails_helper"
RSpec.describe "検索機能", type: :system do
describe "検索(ransack)" do
context "ユーザー検索の場合" do
let!(:user) { create(:user, name: "test") }
let!(:other_user) { create(:user, name: "foobar") }
before do
valid_login(user)
visit users_path
end
it "検索した... |
module DesignerNews
class Stories
include HTTParty
base_uri 'https://api-news.layervault.com/api/v1'
default_params :client_id => ENV['DESIGNER_NEWS_CLIENT_ID']
format :json
def self.recent
stories = get('/stories/recent', :stories)
stories.map { |story| Story.new(story) }
end
... |
class Bed < ActiveRecord::Base
belongs_to :room
OPTIONS = { "No" => 0, "Yes" => 1 }
def get_option(msg)
return OPTIONS.index(msg)
end
end
|
class CreatePays < ActiveRecord::Migration
def change
create_table :pays do |t|
t.string :capitale, null: false
t.string :devise
t.integer :habitants
t.timestamps null: false
end
end
end
|
require 'rubygems'
require File.expand_path('../../lib/songkick/transport', __FILE__)
require 'active_support/notifications'
require 'logger'
require 'sinatra'
require 'thin'
Thin::Logging.silent = true
Songkick::Transport.logger = Logger.new(StringIO.new)
#RSpec.configure { |config| config.raise_errors_for_deprecati... |
class QuizFreeAnswersController < ApplicationController
before_action :set_quiz_free_answer, only: %i[ show edit update destroy ]
# GET /quiz_free_answers or /quiz_free_answers.json
def index
@quiz_free_answers = QuizFreeAnswer.all
end
# GET /quiz_free_answers/1 or /quiz_free_answers/1.json
def show
... |
module BookKeeping
VERSION = 4
end
class Acronym
def self.abbreviate(word)
lista = word.sub(/-/, ' ').split
acr = ""
lista.each do |single|
acr += single.split(//).first.upcase
end
return acr
end
end
puts Acronym.abbreviate('ok b-a ojk')
|
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "virtualbox" do |v|
## See http://docs.vagrantup.com/v2/virtualbox/configuration.html
... |
RENTAL_KEYS = ["id", "checkout_date", "due_date", "movie_id", "customer_id"]
class RentalsController < ApplicationController
before_action :find_movie, only: [:checkout, :checkin]
before_action :find_customer, only: [:checkout, :checkin]
def index
rentals = Rental.all.as_json(only: RENTAL_KEYS)
render js... |
# frozen_string_literal: true
# rubocop get the f..k out
module TrainCarrige
attr_reader :name_manufacturer
def name_manufacturer!
puts 'Введите имя производителя:'
@name_manufacturer = gets.chomp.capitalize
end
end
|
class ChangeColumnNamesInFloorsJobs < ActiveRecord::Migration
def change
rename_column :floors_jobs, :floors_id, :floor_id
rename_column :floors_jobs, :jobs_id, :job_id
rename_column :missions_jobs, :missions_id, :mission_id
rename_column :missions_jobs, :jobs_id, :job_id
end
end
|
=begin
You have a singly-linked list ↴ and want to check if it contains a cycle.
A cycle occurs when a node’s @next points back to a previous node in the list. The linked list is no longer linear with a beginning and end—instead, it cycles through a loop of nodes.
Write a method contains_cycle() that takes the first ... |
module Songkick
module Transport
class Headers
include Enumerable
def self.new(hash)
return hash if self === hash
super
end
def self.normalize(header_name)
header_name.
gsub(/^HTTP_/, '').gsub('_', '-').
downcase.
gsub(/(^|-)([... |
Rails.application.routes.draw do
devise_for :users
root to: 'pages#home'
get '/stats', to: 'pages#stats'
get '/sponsors', to: 'pages#sponsors'
get '/contact', to: 'pages#contact'
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
end
|
# License: GPL v3
# Author: Leonardo Leite (2015)
# Receita de instalação do SonarQube
package "openjdk-7-jdk" do
action :install
end
package "libpq-dev" do
action :install
end
package "postgresql-contrib" do
action :install
end
include_recipe "postgresql::client"
include_recipe "postgresql::server"
include_r... |
module Cinch
module Extensions
class ACL
def initialize
@defaults = {:authname => {}, :channel => {}}
@acls = {
:authname => Hash.new { |h, k| h[k] = {} },
:channel => Hash.new { |h, k| h[k] = {} },
}
end
# @param [:authname, :channel] type
... |
require_relative '../../../../spec_helper'
describe 'cron::crondotdee' do
let(:title) { 'true_cron' }
let (:default_params) {{
:command => '/bin/true',
:hour => '12',
:minute => '34',
}}
context 'with mandatory params' do
let(:params) { default_params }
it { should contain_file('/et... |
class GitHubProfileService
def initialize(token)
@token = token
end
def profile
GitHubProfile.new(raw_profile)
end
private
def conn
Faraday.new(url: "https://api.github.com/user")
end
def response
response ||= conn.get do |request|
request.headers['Authorization'] = "token #{@tok... |
class ThemeTool < ApplicationRecord
belongs_to :tool
belongs_to :theme
end |
module TestUnit
module Generators
class DataMaintenanceGenerator < ::Rails::Generators::NamedBase
source_root File.expand_path('templates', __dir__)
def create_maintenance_test
template 'data_maintenance_test.rb', File.join('test/db/maintenances', "#{file_name}_test.rb")
end
end
e... |
class Link < ActiveRecord::Base
attr_accessible :name, :title, :url
validates_uniqueness_of :url
scope :search, lambda { |phrase|
if connection.adapter_name == 'PostgreSQL'
where("name ilike ?", "%#{phrase}%")
else
where("name like ?", "%#{phrase}%")
end
}
end
|
class Response < ApplicationRecord
validates :full_name, presence: true
validates_numericality_of :number_of_attendees, :only_integer => true
def self.to_csv
attributes = %w{full_name attending number_of_attendees food_allergies song_title singer comment}
CSV.generate(headers: true) do |csv|
csv <... |
require 'rails_helper'
RSpec.describe('Users', type: :request) do
let(:user) { create(:user, :admin) }
it('creates a user and redirects to the index page') do
sign_in(user)
get(new_user_path)
expect(response).to render_template(:new)
attributes = FactoryBot.attributes_for(:user,
... |
app_name = ARGV[0]
unless app_name
puts "Usage: ruby rename.rb new_app_name"
exit
end
# In case someone uses CamelCaseAppName
app_name = app_name.gsub(/(.)([A-Z])/,'\1_\2')
app_name.downcase!
underscore_project_name = app_name.gsub(/\W/, '_').squeeze('_')
camel_project_name = underscore_project_name.split('_').... |
require 'spec_helper'
describe 'User Validation' do
it 'require username' do
user = User.create(username: '')
expect(user.valid?).to be false
expect(user.errors[:username].any?).to be true
end
it 'require password' do
user = User.create(password: '')
expect(user.valid... |
class Game < ActiveRecord::Base
has_many :races
has_many :players, :through => :races
validate :game_must_have_two_established_player
def game_must_have_two_established_player
if 1 == 2
errors.add(:base, "game must have two players")
end
end
end
|
include OCELOT
# Notes about array syntax:
#
# * It's table[1,2] NOT table[1][2]. This has to do with the fact that
# ruby has an operator overload for single-dimensional [] but not (as
# far as I could tell) multi-dim [][]...[].
#
# * Access is column-major.
# Table tests
Spreadsheet::create "spreadsheet-test" do
... |
require 'rails_helper'
RSpec.feature 'Updating school headteacher details' do
let(:non_support_third_line_user) { create(:support_user) }
let(:support_third_line_user) { create(:support_user, :third_line) }
let(:school) { create(:school) }
let(:school_page) { PageObjects::Support::SchoolDetailsPage.new }
let... |
# Copyright (c) 1999-2006 Minero Aoki
#
# This program is free software.
# You can distribute/modify this program under the same terms of ruby.
# see the file "COPYING".
module Racc
module Source
NL = /\n|\r\n|\r/
TAB_WIDTH = 8
TAB_TO_SPACE = (' ' * TAB_WIDTH).freeze
TERM_WIDTH = 80
... |
module Excon
module Errors
class Error < StandardError; end
class StubNotFound < StandardError; end
class InvalidStub < StandardError; end
class SocketError < Error
attr_reader :socket_error
def initialize(socket_error=nil)
if socket_error.message =~ /certificate verify failed/
... |
require 'rails_helper'
describe 'Slack Command Controller', type: :request do
let(:category) { Fabricate(:category) }
let(:tag) { Fabricate(:tag) }
let(:tag2) { Fabricate(:tag) }
describe 'with plugin disabled' do
it 'should return a 404' do
post '/chat-integration/slack/command.json'
expect(r... |
class AddRoundsPlayedToUser < ActiveRecord::Migration
def change
add_column :users, :lifetimeroundsplayed, :integer, default: 0
end
end
|
require 'rails_helper'
describe "Creating a new developer" do
it "saves the developer and show the list of developer" do
login
visit developers_url
click_link "Add New"
expect(current_path).to eq(new_developer_path)
fill_in "Name", with: "Pan Samnang"
fill_in "Web", with: 'www.google.com'
... |
class ProductsController < ApplicationController
def new
@product = Product.new
@tags = Tag.all.pluck(:name,:id)
end
def create
@product = Product.new(name: product_params[:name])
@product.price = product_params[:price]
@product.details = product_params[:details]
@product.description = ... |
# 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 Draw
attr_reader :list
def initialize(list)
@list = list
end
def shuffle_list
givers = list.shuffle
receivers = givers
last = receivers.shift
receivers = receivers.push(last)
end
end
|
class Order < ApplicationRecord
belongs_to :shop
belongs_to :customer
belongs_to :flower
has_many :owners
before_save :finalize
def finalize
self[:amount] = quantity * flower.cost
end
end
|
require 'json'
module HelperMethods
def promo_rules
{
value_rules: [
{
minimum_value: 60,
discount_decimal: 0.1
}
],
volume_rules: {
"001": {
minimum_volume_required: 2,
discounted_price: 8.50
}
}
}
end... |
Rails.application.routes.draw do
# resources :reviews
# resources :add_products
resources :products
# resources :categories
# resources :carts
# resources :users
# get '/reviews', to: 'reviews#index'
get '/categories', to: 'categories#index'
get '/categories/:id', to: 'categories#show'
post '/addProduc... |
module CDI
module V1
class SimpleStudentClassSerializer < ActiveModel::Serializer
root false
attributes :id, :name, :admin_user_id,
:code, :code_expiration_date, :educational_institution_id,
:code_expired?,:status, :status_changed_at,
:created_at, :... |
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
def current_user
if params[:role].present?
session[:role] = params[:role]
end
User.new(role: session[:role])
end
# Globally rescue Authorization Errors in controller.
# Returning 403 Forbidden if pe... |
require 'spec_helper'
require 'generators/transponder/service/service_generator'
describe Transponder::Generators::ServiceGenerator do
destination File.expand_path("../../../../../tmp", __FILE__)
before { prepare_destination }
it "should run all tasks" do
gen = generator %w(infinite_scroll)
gen.shoul... |
class UserProfileController < ApplicationController
def new
@user = current_user
end
def create
@profile = current_user.build_profile(profile_params)
if @profile.save
redirect_to feed_path
else
flash[:danger] = 'There was a problem creating your profile'
render 'new'
end
end
p... |
require "rspec"
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../")
require 'lib/order.rb'
module Shop
describe Order do
it "should add a new product to the order" do
order = Order.new Reporter.new, do
add :shirt, 2
end
order[:shirt].should == 2
end
it "should default the q... |
class User < ApplicationRecord
has_many :posts
has_many :comments, :through => :posts
end
|
class Magazine < ActiveRecord::Base
has_many :accents
has_many :dailies
has_many :galleries
# Paperclip
has_attached_file :cover, :url => "/system/magazines/:id/cover/:style.:extension", :styles => {
:thumb => "150x150",
:medium => "1014x1201"
}
has_attached_file :month, :url => "/system/magaz... |
class FontCinzelDecorative < Formula
head "https://github.com/google/fonts.git", verified: "github.com/google/fonts", branch: "main", only_path: "ofl/cinzeldecorative"
desc "Cinzel Decorative"
homepage "https://fonts.google.com/specimen/Cinzel+Decorative"
def install
(share/"fonts").install "CinzelDecorativ... |
class V1::UsersController < V1::BaseController
skip_before_action :authenticate_user, only: :create
def show
render json: UserSerializer.new(current_user)
end
def create
result = Users::Create.call(params: user_params)
if result.success?
render json: UserSerializer.new(result.user), status:... |
class Api::V1::ItemsController < ApplicationController
def index
items = Item.all
render json: items
# render json: items.with_attached_image
end
def create
# binding.epry
item = Item.new(item_params)
# item.images.attach(params[:item][:im... |
# -*- encoding: utf-8 -*-
require 'digest/md5'
require 'cgi'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
module Integrations #:nodoc:
module Tenpay
class Helper < ActiveMerchant::Billing::Integrations::Helper
MAPPING_FIELDS = [
:sign_type, :service_version, :input_ch... |
class Favorite < ApplicationRecord
belongs_to :user
belongs_to :item
validates :user_id, presence: true
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 bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
# ... |
class PetsController < ApplicationController
before_action :set_pet, only: [:show, :matching]
PERPAGE = 30
def index
page = (params['page'] || 1).to_i
@pets = Pet.page(page).per(PERPAGE)
json_response(
@pets,
pagination(@pets, PERPAGE)
)
end
def show
json_response(@pet)
en... |
class SocialProvider < ActiveRecord::Base
#Relations
belongs_to :user
def self.find_for_oauth(auth, provider_type)
unless social_provider = self.find_by(pid: auth[:uid].to_s, provider_type: provider_type)
user = User.find_by_email(auth[:info][:email])
social_provider = user.social_providers.wher... |
# encoding: utf-8
class ReportGenerators::FacebookReport < ReportGenerators::Base
def self.can_process? type
type == FacebookDatum
end
def add_to document
if !facebook_datum.empty?
add_information_to document
end
end
private
def facebook_datum
social_network.facebook_data.where('st... |
# encoding: utf-8
require File.expand_path("../spec_helper", __FILE__)
describe "IE" do
# Class methods
it "responds to .speed" do
WatirSpec.implementation.browser_class.should respond_to("speed")
end
it "responds to .speed=" do
WatirSpec.implementation.browser_class.should respond_to("speed=")
end... |
class CreateInterrelationships < ActiveRecord::Migration[5.0]
def change
create_table :interrelationships do |t|
t.integer :follower_id
t.integer :followed_id
t.timestamps
end
add_index :interrelationships, :follower_id
add_index :interrelationships, :followed_id
add_index :inte... |
class SupervisorsController < ApplicationController
before_action :validate_url_hack, only: [:edit, :update]
before_action :logged_in_supervisor, only: [:edit, :update]
before_action :correct_supervisor, only: [:edit, :update]
def new
@supervisor = Supervisor.new
end
def create
@superviso... |
# frozen_string_literal: true
require "rails_helper"
RSpec.describe ExternalServiceManager do
Settings.external_services.to_hash.each do |service, klass_name|
it "has an accessor specific to this service" do
expect(described_class).to respond_to "#{service}_service"
end
it "returns the class set... |
class AddValidToJapans < ActiveRecord::Migration[5.2]
def change
add_column :japans, :selectee, :boolean, default: false
add_column :japans, :validee, :boolean, default: false
end
end
|
class Api::WorkExperiencesController < Api::BaseController
before_action :authenticate_user!
def index
@experiences = current_user.work_experiences.all
respond_with @experiences
end
def new
@job_levels = ['Not Applicable', 'Entry Level/Fresh Grad', 'Junior', 'Senior'].sort
... |
class Connection < ActiveRecord::Base
belongs_to :follower, class_name: 'User', foreign_key: :follower_id
belongs_to :leader, class_name: 'User', foreign_key: :leader_id
validates_uniqueness_of :follower_id, scope: :leader_id
end |
#!/usr/bin/env ruby
require 'mysql'
word_count = {}
stop_words = "a,able,about,across,after,all,almost,also,am,among,an,and,any,are,as,at,be,because,been,but,by,can,cannot,could,dear,did,do,does,either,else,ever,every,for,from,get,got,had,has,have,he,her,hers,him,his,how,however,i,if,in,into,is,it,its,just,least,let... |
class Cell
attr_reader :row, :column
attr_accessor :up, :down, :left, :right, :player, :target
#Initializes relevant instance variables; coordinates / connections hash which will be
#populated by maze creating algorithm + variable to determine if player inhabits this node or not
def initialize(row, column... |
module Features
module FillHelper
def fill_in_datetime_field(name, with:)
datetime_field = fill_in(name, with: with)
datetime_field.ancestor('.datetime-picker').sibling('.hbw-datetime-label').click
end
end
end
|
require 'librarian/puppet/version'
require 'librarian/puppet/source/repo'
module Librarian
module Puppet
module Source
class RPM
class Repo < Librarian::Puppet::Source::Repo
include Librarian::Puppet::Util
def versions
# We only ever have a single possible match for... |
namespace :scrape do
desc "Enqueue Matvaran urls to be scraped by the scraper"
task matvaran: :environment do
MatvaranEnqueuer.new.start
end
end
|
class User
include MongoMapper::Document
key :uid, String
key :nickname, String
key :name, String
key :email, String
many :recipes
many :rails_templates
def self.from_hash(auth_hash)
user = authorize(auth_hash['uid'])
user ||= User.create(
:uid => auth_hash['uid'],
:n... |
class DepositRequestMailer < ApplicationMailer
def payment_succeeded request
@request = request
mail(to: @request.wallet.user.email, subject: "⚽️ Bookingsports: Баланс пополнен")
end
end
|
require 'rails_helper'
describe ContactsController do
let(:contact) do
create(:contact, firstname: 'Lawrence', lastname: 'Smith')
end
shared_examples 'public access to contacts' do
describe 'GET #index' do
# params[:letter]がある場合
context 'with params[:letter]' do
# 指定された文字で始まる連絡先を配列にま... |
module Users
class PasswordReset < Mutations::Command
required do
string :token
string :password, min_length: 8
end
def validate
@user = User.where(password_reset_token: self.token).first
unless @user
add_error(:token, :invalid, 'Invalid token')
end
end
def ... |
class Queens
attr_reader :white, :black
def initialize(positions = {white: [0,3], black: [7,3]})
raise ArgumentError if positions[:white] == positions[:black]
@white = positions[:white]
@black = positions[:black]
end
def attack?
horizontal? || vertical? || diagonal?
end
def to_s
boar... |
module Ruby
module HL7
class MSA < Segment
weight 0 # should occur after the msh segment
add_field :ack_code, :idx => 1
add_field :control_id, :idx => 2
add_field :text
add_field :expected_seq
add_field :delayed_ack_type
add_field :error_cond
end
end
end |
class ProjectStatus < ActiveRecord::Base
has_many :projects, dependent: :destroy
validates_presence_of :status
end
|
# multi_post.rb
# Author: m-1-k-3 (Web: http://www.s3cur1ty.de / Twitter: @s3cur1ty_de)
# This Metasploit RC-File could be used to automate the post-exploitation process
# VERBOSE is used from the global datastore
# check out the meterpreter_commands and the modules_win and modules_lin and modules_multi
# you could ad... |
class SessionsController < ApplicationController
before_action :check_signed, only: [:new, :create]
def current_user_page
redirect_to(signin_path) and return if !signed_in?
@user = current_user
@title = "Личный кабинет"
render "users/show"
end
def new
@title = @header = 'Вход на сайт'
re... |
class Variable
include Mongoid::Document
embedded_in :application, inverse_of: :global_variables
embedded_in :application_template
# validates_uniqueness_of :name, scope: :application, if application.present?
# validates_uniqueness_of :name, scope: :application_template, if application_template.present?
... |
require 'rails_helper'
RSpec.describe 'GET /api/v1/slides' do
it 'returns a list of all slides' do
user = User.create(github: "s-espinosa")
Fabricate.times(2, :slide, user: user)
get '/api/v1/slides'
expect(json_body.count).to eq(2)
end
end
|
class IndustryEvent < ActiveRecord::Base
belongs_to :industry
belongs_to :event
validates_presence_of :industry_id, :event_id
end
|
class ArticlesController < ApplicationController
before_action :authenticate_user!, only: %w[create update destroy]
before_action :find_articles, only: %w[show update destroy]
def index
articles = Article.all
render json: {status:"success", data: articles}
end
# show detail data GET /articles/:id
... |
require 'spec_helper'
describe 'trusted_certificate::default' do
let(:chef_run) { ChefSpec::SoloRunner.converge(described_recipe) }
it 'installs ca-certificates' do
expect(chef_run).to install_package('ca-certificates')
end
end
|
class SpecTiller
def initialize(travis_path:, spec_dir:)
@yaml = TravisYaml.new(filepath: travis_path)
@current_specs = current_specs(glob)
@working_matrix = @yaml.build_matrix.slice(0..@yaml.num_builds)
@ignored_lines = @yaml.build_matrix.slice(@yaml.num_builds..-1)
end
def sync
Pipe.
... |
require 'puppet'
require 'pp'
Puppet::Type.type(:glusterfs_pool).provide(:glusterfs) do
commands :glusterfs => 'gluster'
defaultfor :feature => :posix
def self.instances
glusterfs('peer','status').split(/\n/).collect do |line|
if line =~ /Hostname:\s(\S+)$/
new(:name => $1)
else
... |
require 'test_helper'
class FaturasControllerTest < ActionDispatch::IntegrationTest
setup do
@fatura = faturas(:one)
end
test "should get index" do
get faturas_url
assert_response :success
end
test "should get new" do
get new_fatura_url
assert_response :success
end
test "should cre... |
# frozen_string_literal: true
module Tianguis
module Parser
class Market < Base
def table
table = page.css('#ddlDestinoInfEsp option')
table.shift
table
end
def list
table.map do |row|
state, name = row.text&.split(': ')
{
id: row... |
# frozen_string_literal: true
require 'common/models/base'
module Preneeds
class Claimant < Preneeds::Base
attribute :date_of_birth, String
attribute :desired_cemetery, String
attribute :email, String
attribute :phone_number, String
attribute :relationship_to_vet, String
attribute :ssn, Stri... |
# Copyright (c) 2009-2011 VMware, Inc.
$:.unshift File.join(File.dirname(__FILE__), '..')
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'rubygems'
require 'rspec'
require 'bundler/setup'
require 'vcap_services_base'
require 'postgresql_service/util'
require 'postgresql_service/provisioner'
require... |
require 'rails_helper'
describe CommandHandlers::FailJob do
include Commands::Execute
describe '#call' do
let(:uid) { Time.current.strftime("%H%M%S%L#{SecureRandom.random_number(100)}") }
context 'when success' do
it 'Events::StateChangedToError event published (integration)' do
cmd = Comma... |
class AddEstadoToFichas < ActiveRecord::Migration
def change
add_column :fichas, :estado, :boolean
end
end
|
class Board
attr_reader :rows
def initialize options
default_width = 20
width = options[:width] ? options[:width] : default_width
@rows = options[:row] ? [options[:row]] : [Array.new(width) { rand(0..1) }]
@parent_types = (0..7).map { |i| ("0" * (3 - i.to_s(2).length) + i.to_s(2)).split('').map { |j| j.to_i ... |
# frozen_string_literal: true
module Api::V1
class SubscriptionPolicy < ApplicationPolicy
def cancel?
record.user_id == user.id
end
end
end
|
#!/usr/bin/env ruby
# == Synopsis
#
# stop.rb: Stops a currently running JoCoBot
#
# == Usage
#
# ruby stop.rb [OPTIONS]
#
# -h, --help:
# show help
#
require File.dirname(__FILE__) + '/../conf/include'
require 'getoptlong'
require 'rdoc/usage'
opts = GetoptLong.new(['--help', '-h', GetoptLong::NO_ARGUMENT])
opts.... |
class BingHomePage
include PageMixIn
attr_accessor :search_field, :bing_search_button
URLS = { :production => "http://www.bing.com/" }
def initialize browser
@browser = browser
@bing_search_button = @browser.button(:name => "go")
super
end
def visit
@browser.goto URLS[:production]
end... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.