text stringlengths 10 2.61M |
|---|
# encoding: UTF-8
require "minitest/autorun"
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
require 'latinverb'
class TestAmbiguousLookups < MiniTest::Unit::TestCase # :nodoc:
def setup
@aFourth = Linguistics::Latin::Verb::LatinVerb.new 'audiō audīre audīvī auditum'
end
def test_ambiguous_loo... |
module Astrails
module Safe
class Source < Stream
def initialize(id, config)
@id, @config = id, config
end
def filename
@filename ||= expand(":kind-:id.:timestamp#{extension}")
end
# process each config key as source (with full pipe)
def self.run(config)
... |
module Runa
class Job
attr_accessor :worker, :job_id
def self.queue(*params)
Runa::QueuedJob.queue(self.new(*params))
end
def puts(text)
Runa.log :debug, "\e[37m#{text}\e[0m", "#{worker} [#{job_id}]"
end
alias_method :log, :puts
end
end
|
# A wrapper around Naf::Machine used for rendering in views
module Logical
module Naf
class Machine
include ActionView::Helpers::DateHelper
COLUMNS = [:id,
:server_name,
:server_address,
:server_note,
:enabled,
:pr... |
require 'rubygems'
require 'bundler'
Bundler.require
library :robotlegs, :swc
##############################
# Configure
##
# Set USE_FCSH to true in order to use FCSH for all compile tasks.
#
# You can also set this value by calling the :fcsh task
# manually like:
#
# rake fcsh run
#
# These values can also be s... |
class AdminChangePasswordType < Admin
include ApplicationType
has_secure_password
permit :password, :password_confirmation
end
|
require 'spec_helper'
describe PostForm do
it "saves" do
board = Board.create
branch = Branch.new
leaf = Leaf.new(name: 'hi', content: 'hello')
new_post = PostForm.new board, branch, leaf
new_post.save!
[leaf,board,branch].each { |record| record.reload }
expect(leaf.branch).to eq branch
... |
class StoreController < ApplicationController
def index
@products = Product.order(:title)
@counter = access_count
end
private
def access_count
if session[:counter].nil?
session[:counter] = 0
end
session[:counter] += 1
end
end
|
require 'spec_helper'
describe RunPal::FilterPostsByGender do
before :each do
RunPal.db.clear_everything
end
it 'filters posts by gender' do
user1 = RunPal.db.create_user({first_name:"Isaac Asimov", gender: 2, email: "write@smarty.com", bday: "02/08/1987"})
user2 = RunPal.db.create_user({first_name... |
require 'rails_helper'
RSpec.describe User, type: :model do
describe 'associations' do
it { is_expected.to have_many(:articles) }
it { is_expected.to have_one(:profile) }
end
describe 'callbacks' do
let(:user) { create(:user) }
context 'when user is created profile is created' do
subject ... |
class PartBom < ActiveRecord::Base
validates :part_id, uniqueness: {scope: :bom_item_id, message: 'part bom item should be uniq'}
belongs_to :part
belongs_to :bom_item, class_name: 'Part'
def self.detail_by_part_id(id)
if part=Part.find_by_id(id)
return detail_by_part(part)
end
end
def self... |
# Authors controller
class AuthorsController < ApplicationController
def index
respond_to do |format|
format.html
format.json { render json: { data: Author.all }, status: :ok }
end
end
def create
Author.create(book_params)
end
private
def book_params
params.require(:author).pe... |
module ArticleSplitable
extend ActiveSupport::Concern
def grid_area
column*row
end
def article_grid_rect
[grid_x, grid_y, column, row]
end
def preferable_direction
rect = article_grid_rect
if rect[2] >= rect[3]
direction = 'vertical'
else
direction = 'horizontal'
end
... |
require 'rspec'
require './00_tree_node'
describe PolyTreeNode do
let(:node1) { PolyTreeNode.new('root') }
let(:node2) { PolyTreeNode.new('child1') }
let(:node3) { PolyTreeNode.new('child2') }
describe "#initialize" do
let(:new_node) { PolyTreeNode.new('new_node') }
it "should set an initial value" d... |
class Country < ActiveRecord::Base
has_many :persons
has_many :users
has_many :educations
has_many :travels
has_many :crimes
has_many :accesses, dependent: :destroy
has_many :users, through: :accesses
has_many :categories, through: :accesses
end
|
require "spec_helper"
RSpec.describe "Day 15: Dueling Generators" do
let(:runner) { Runner.new("2017/15") }
let(:input) do
<<~TXT
Generator A starts with 65
Generator B starts with 8921
TXT
end
describe "Part One" do
let(:solution) { runner.execute!(input, part: 1, CHECKS: 5) }
it... |
class Admin < ActiveRecord::Base
belongs_to :club
acts_as_authentic do |c|
c.validates_format_of_login_field_options = {:with => /^[A-Za-z\d_]+$/, :message => "name is invalid. Only letters, numbers, and underscores allowed."}
c.validates_length_of_password_field_options = {:minimum => 6, :if => :requi... |
require 'rails_helper'
RSpec.describe DestinationCard, type: :model do
describe '商品購入機能' do
before do
user = FactoryBot.create(:user)
product = FactoryBot.create(:product)
@destination_card = FactoryBot.build(:destination_card, user_id: user.id, product_id: product.id)
sleep(0.1)
end
... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Author: Tuomo Tanskanen <tuomo@tanskanen.org>
Vagrant.require_version ">= 1.5.0"
Vagrant.configure("2") do |config|
config.vm.define :gitlab do |config|
# Configure some hostname here
# config.vm.hostname = "gitlab.invalid"
config.vm.box = "hashicorp/precise64... |
class RenameMediaTabletoMediumsTable < ActiveRecord::Migration
def change
rename_table :media, :mediums
end
end
|
# For Tests; Truncate tables
# require 'active_record/base'
# require 'active_record/connection_adapters/abstract_mysql_adapter'
class Truncation
# ActiveRecord::Base.connection
def initialize(env = "test")
@env = env
@connection = connect!
end
def connect!
@config = ActiveRecord::Base.configurat... |
class Transaction
attr_reader :amount, :id
def initialize(id, amount)
@id = id
@amount = amount
end
end |
#link to the Bike class
require '~/Desktop/makers/dev/boris-bikes/lib/bike'
#describing the functionality of the class Bike
describe Bike do
let(:bike) {Bike.new}
it "should not be broken after we create it" do
expect(bike).not_to be_broken
end
it "should be able to break" do
bike.break
expect(bike)... |
class Pet < ApplicationRecord
validates :name, presence: true
validates :age, presence: true, numericality: true
belongs_to :shelter
has_many :application_pets, dependent: :delete_all #added extra stuff here, but not else where. WHY?
has_many :applications, through: :application_pets
def shelter_name
... |
class AddCajonsuperiorToOrdenmescams < ActiveRecord::Migration[5.1]
def change
add_column :ordenmescams, :cajonsuperior, :string
end
end
|
class RemindingMailer < ActionMailer::Base
default from: Setting.mail_from
def self.default_url_options
Mailer.default_url_options
end
def reminder_email(user,issue)
@user=user
@issue=issue
mail(to: @user.mail, subject: @issue.subject, cc: Setting.plugin_redmine_update_reminder['cc'] )
end... |
class Review < ApplicationRecord
belongs_to :animal
has_many :favorites, dependent: :destroy
has_many :users_who_favor, through: :favorites, source: :user
validates :star_count, presence: true, numericality: {greater_than: 0, less_than: 6}
end
|
#
# Cookbook Name:: timezone-ii
# Recipe:: rhel
#
# Copyright 2013, fraD00r4 <frad00r4@gmail.com>
# Copyright 2015, Lawrence Leonard Gilbert <larry@L2G.to>
#
# Apache 2.0 License.
#
# If it is being run on EL 7 or newer, the recipe will be skipped and
# the "rhel7" recipe will be included instead.
el_version = node[:p... |
class AddIssueOrderToSupplementals < ActiveRecord::Migration
def change
add_column :supplementals, :issue_order, :integer, default: 0
end
end
|
# frozen_string_literal: true
require './lib/exceptions/http_exception'
require './lib/adapters/http'
module Gateways
class Credita
attr_reader :id, :logger
def self.buyer(id, logger)
new(id, logger).buyer
end
def initialize(id, logger)
@id = id
@logger = logger
end
def ... |
class GithubService
def initialize(token)
@token = token
end
def find_user
get_json('/user')
end
def get_id(handle)
get_json("/users/#{handle}")
end
def find_repos
get_json('/user/repos')
end
def find_followers
get_json('/user/followers')
end
def find_followed
get_json... |
module QBIntegration
module Service
class Account < Base
def initialize(config)
super("Account", config)
end
# NOTE Can't we just do config.fetch("quickbooks_account_name") here?
# Considering each request will only be provided with one account name
def find_by_name(account_... |
furry_family = {dog: "Chuck", cat: "Zoomer", ferret: "wiggles"}
human_family = {wife: "Breanna", daughter: "Rhaelynn", brother: "Nathaniel"}
family = human_family.merge(furry_family)
p furry_family
p human_family
p family
gets
mutated_family = human_family.merge!(furry_family)
p furry_family
p human_family #In... |
#!/usr/bin/env ruby
# small script to fetch the status of a hadoop namenode
require 'net/http'
require 'rubygems'
require 'json'
# go through the hiera tree we defined and look for the desired host types
<%- namenodes = [] -%>
<%- @nodes.each_pair do |hostname, hostinfo| -%>
<%- if hostinfo['type'] == 'namenode_ac... |
class AddMeetingToDocument < ActiveRecord::Migration
def change
add_reference(:documents, :meeting, foreign_key: true)
remove_column(:documents, :revision_date, :date)
end
end
|
module JoelStack
module MyFirstCloudformationTemplate
extend ActiveSupport::Concern
included do
# Example variable definition
# variable :bucket_suffix,
# default: "-bucket",
# value: ENV["BUCKET_SUFFIX"]
description "Joels CloudFormation stack"
resour... |
require 'spec_helper'
include Warden::Test::Helpers
Warden.test_mode!
feature 'user submits a battery' do
scenario 'logged-in admin updates battery with valid attributes' do
user = FactoryGirl.create(:user, admin: true)
login_as(user, :scope => :user)
visit '/batteries/new'
fill_in 'Manufacturer', w... |
class CreateTrnProdPlanMasters < ActiveRecord::Migration[6.0]
def change
create_table :trn_prod_plan_masters do |t|
t.string :trt_code, :null => false
t.string :plant, :limit => 4, :null => false
t.string :work_center, :limit => 10, :null => false
t.integer :re_order_per
t.integer :no_of_hrs
... |
require 'rails_helper'
RSpec.describe Audio, type: :model do
before(:each) do
@uploader = User.create(uid: '123', nickname: 'louise')
end
it "is not valid without a title" do
audio = Audio.new(title: nil)
expect(audio).to_not be_valid
end
it "is not valid when title is too short" do
audio ... |
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |spec|
spec.name = 'jirastorm'
spec.version = '0.1.0'
spec.authors = ['David Danzilio', 'Jim Cuff']
spec.email = ['david@danzilio.net']
spec.summary ... |
require 'rails_helper'
RSpec.feature "GuestCannotAccessRootWithoutLoggingIns", type: :feature do
it "should redirect to login page if user not signed in" do
user = create(:user)
visit '/'
expect(current_path).to eq login_path
fill_in "Email", with: user.email
fill_in "Password", with: "123"
... |
require 'test/unit'
class StringTest < Test::Unit::TestCase
def test_1
#The "\x" is a special escape to encode an arbitrary byte from hex, so "\xE5" means byte 0xE5.
puts "\xE5"
puts "\xA3"
puts '\xE5'
puts 0b101010
end
def test_2
# oss: il carattere q o Q è opzionale.
# A livello ... |
#!/usr/bin/env ruby
# For each .wav file foo.wav in the current directory,
# split it into clips, each slightly shorter than 1.25 seconds,
# named foo-usecStart-usecEnd.mp3 and .ogg.
#
# Makes about 2800 clips per minute, singlethreaded.
# Runs at 18x real time, in other words.
$slice = 1.25 # Longest duration of a c... |
module DataGenerator
class Model
attr_reader :attributes
def initialize
@attributes = Hash.new
end
def method_missing(m, *args, &block)
match_result = /\A(.+)=\Z/.match(m.to_s)
if match_result
@attributes[match_result[1].to_sym] = args.first
else
super(m, args... |
Fabricator(:temple) do
name { sequence(:name) { |i| SecureRandom.hex(12) + i.to_s } }
country_id { Fabricate(:country).id }
end
|
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
get 'api/products', to: 'products#index', as: 'all_products'
scope :api do
namespace :cart do
resources :products
end
end
get 'api/cart', to: 'carts#cart_inf... |
$LOAD_PATH << '../comrank/lib'
require 'active_support/all'
require 'sinatra/base'
require 'sinatra/config_file'
require 'sinatra/multi_route'
require 'sinatra/json'
require 'sinatra/jsonp'
require 'sinatra/cross_origin'
require 'sinatra/default_charset'
require 'sinatra_more/markup_plugin'
require 'tilt/haml'
require... |
class EmailWorker
include Sidekiq::Worker
def perform(email_params)
response = Typhoeus.post("localhost:3000/email.json", params: email_params)
end
end
|
# frozen_string_literal: true
class GroupMember < ApplicationRecord
belongs_to :group, counter_cache: true
belongs_to :user
has_many :assignments, through: :group
after_commit :send_welcome_email, on: :create
def send_welcome_email
GroupMailer.new_member_email(user, group).deliver_later
end
end
|
class Account
attr_reader :name, :transactions, :starting_balance
def initialize(account_data, transactions = [])
@name = account_data['Account']
@starting_balance = account_data['Balance']
@transactions = transactions
end
def current_balance
ending_balance = starting_balance
transactions... |
=begin
Class PISiteController
WARNING : cette classe ne s'appelle pas directement. Elle doit être chargée
par les contrôleurs de type PISite (NarrationController, ProgrammationController)
afin d'hériter 1/ des méthodes propres aux contrôleurs PISite et 2/ de
charger les librairies utiles.
=end
class PISite... |
require 'rails_helper'
RSpec.describe Order, type: :model do
describe 'associations' do
it { should have_many(:items).through(:item_orders) }
it { should belong_to(:user) }
end
describe 'validation' do
it { should validate_presence_of(:item_ids) }
let(:user) { create(:user) }
let(:items) {... |
#
# Authors: Christopher M Wood (<woodc@us.ibm.com>)
# John F Hutchinson (<jfhutchi@us.ibm.com)
# © Copyright IBM Corporation 2015.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#
=begin
TODO:
1.Add Connectivity Methods for Non SSH connections.
2.Check if the password is passed in clear tex... |
json.array!(@events) do |event|
json.title 'Busy'
json.start event.start_time
json.end event.end_time
end
|
# frozen_string_literal: true
require "spec_helper"
module Decidim
module Opinions
describe CollaborativeDraftPresenter, type: :helper do
subject { described_class.new(collaborative_draft) }
let(:collaborative_draft) { build(:collaborative_draft, body: content) }
describe "when content conta... |
class AddBugFieldToFeatures < ActiveRecord::Migration
def change
add_column :features, :bug, :boolean
end
end
|
# MTA Line
# Lines and its station
def lines_and_stations
lines_stations = {
:n => [
"Times Square",
"34th",
"28th",
"23rd",
"Union Square",
... |
class PetBreed < ActiveRecord::Base
belongs_to :pet
belongs_to :breed
end
|
class AuthProfile < ActiveRecord::Base
attr_accessible :auth_reference_id, :auth_type, :type, :user_id, :fail_count, :ocra_id, :ocra_sw_id
belongs_to :user
validates_uniqueness_of :auth_type, :scope => :user_id
end
|
require 'delegate'
require 'yaml'
module Repub
class App
module Profile
PROFILE_KEYS = %w[css encoding helper metadata remove rx selectors].map {|k| k.to_sym}
def load_profile(name = nil)
name ||= 'default'
profile = Profile.new
profile[name] ||= {}
PROFILE_KEY... |
describe "CartCreateOperation" do
let(:cart) { double }
let(:pipe) { double }
subject(:cart_create_page) do
require __FILE__.sub("/spec/", "/").sub("_spec.rb", ".rb")
CartCreateOperation.new
end
def load_from_params_prepare_fakes
cart.should_receive(:load_from_params).with attribute_group: :for_c... |
# frozen_string_literal: true
module TimeZoneDetection
protected
def switch_time_zone
time_zone = params[:time_zone]
Time.zone = allowed_time_zone?(time_zone) ? time_zone : default_time_zone
end
def allowed_time_zone?(time_zone)
time_zone && ActiveSupport::TimeZone.new(time_zone).present?
end
... |
# frozen_string_literal: true
# Collections helper methods.
module CollectionsHelper
require 'csv'
def display_domains(user_id, collection_id, account)
collection_path = ENV['DOWNLOAD_PATH'] +
'/' + account.to_s +
'/' + collection_id.to_s + '/'
collection_domain... |
class InstalledBase::ClientsController < InstalledBase::BaseController
before_filter :find_client, except: [:index, :new, :create]
def index
@clients = Client.order(:code).page(params[:page]).per(10)
end
def show
end
def new
@client = Client.new
end
def create
@client = Client... |
# == Schema Information
# Schema version: 57
#
# Table name: messages
#
# id :integer(11) not null, primary key
# user_id :string(255) default(""), not null
# topic :string(255)
# data :text
# created_at :datetime
# updated_at :datetime
#
class Messa... |
require 'vigil/task'
class Vigil
class ReuseBoxTask < Task
private
def post_initialize(args)
@name = args.fetch(:name)
@box = args.fetch(:box)
end
def name; @name; end
def commands
[ ['ln', @session.revision.previous.send(@box), @session.revision.send(@box) ] ]
... |
#!/usr/bin/env ruby
require 'rubygems'
require 'awesome_print'
require 'find'
class FindSameNameSources
def initialize
@path_by_filename = Hash.new
end
def check_dir(dir)
Find.find(dir) do |path|
next unless is_code_path? path
check_file(path)
end
end
def check_file(path)
filen... |
# encoding: UTF-8
lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
require 'log2carbon/version'
Gem::Specification.new do |s|
s.name = 'log2carbon'
s.version = Log2Carbon::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Josep M. Pujol"]
s.email ... |
class Puppy
def initialize
puts "Initalizing new puppy instance...."
end
def fetch(toy)
puts "I brought back the #{toy}!"
toy
end
def speak(i)
i.times {p "woof"}
end
def roll_over
puts "roll over"
end
def dog_years(human_years)
puts human_years / 7
end
def jump
puts "... |
require 'sinatra/base'
require 'haml'
require 'tilt/haml'
require 'converter/logconverter'
VIEWS_PATH = File.join(
File.dirname(File.absolute_path(__FILE__)),
'..', '..', 'views'
)
class LogConverterApp < Sinatra::Application
def initialize
super
@output_path = '/tmp/log-converter'
@lc = LogConvert... |
class User < ApplicationRecord
has_many :comment
has_many :follow
has_many :innapropiate
has_many :post
has_many :vote
has_one :profile
validates :name, presence: true , format: { with: /\A[a-zA-Z]+\z/}
validates :password, presence: true
validates :email, presence: true , format: { with: URI::MailTo... |
class ProgressBar
class Base
include ProgressBar::LengthCalculator
include ProgressBar::Formatter
DEFAULT_OUTPUT_STREAM = $stdout
def initialize(options = {})
self.output = options[:output] || DEFAULT_OUTPUT_STREAM
autostart = options.fetch(:autostart, true)
super(op... |
# Copyright Dave Trollope 2014
# This source code is not to be distributed without agreement from
# D. Trollope
#
# This file implements a basic publisher.
# It supports TCP and UDP (Raw, Unicast and Multicast) data flows.
#
# This example registers the publisher name with the name server and includes the data
# flow I... |
require 'rails_helper'
RSpec.describe Professional, type: :model do
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:description) }
it { is_expected.to validate_presence_of(:email) }
it { is_expected.to validate_presence_of(:cell_phone) }
end
|
Regexp#match?: 2630002.5 i/s
Regexp#===: 872217.5 i/s - 3.02x slower
Regexp#=~: 859713.0 i/s - 3.06x slower
Regexp#match: 539361.3 i/s - 4.88x slower
^foo (\w+)$/ =~ 'foo bar' # => 0
$~ # => #<MatchData "foo bar" 1:"bar">
/^foo (\w+)$/.match('foo baz') # => #<MatchData "... |
require 'spec_helper'
describe AccountsController do
describe "#new" do
before do
get :new
end
it "should be successful" do
response.should be_success
end
it "should create an account object" do
assigns(:account).should_not be_nil
end
end
describe "#create" do
before do
post :create,... |
class FontMegrim < Formula
head "https://github.com/google/fonts/raw/main/ofl/megrim/Megrim.ttf", verified: "github.com/google/fonts/"
desc "Megrim"
homepage "https://fonts.google.com/specimen/Megrim"
def install
(share/"fonts").install "Megrim.ttf"
end
test do
end
end
|
require File.dirname(__FILE__) + "/../spec_helper"
describe GroupScenario do
it { should belong_to(:group) }
it { should belong_to(:scenario) }
it { should validate_presence_of(:group) }
it { should validate_presence_of(:scenario) }
context do
subject { Factory(:group_scenario) }
it { should... |
require_relative '../config/environment'
#INSERT some code that resets the database so id starts @ 0
#INSTRUCTIONS
puts "Welcome to CLI Othello!!"
puts "To make a move, enter an x and y coordinate when prompted."
puts "For example, to place a chip on x:1 y:1 enter: 11"
#instantiate a new board'
Board.destroy_all
Bo... |
class Entry < ApplicationRecord
belongs_to :category
validates :name, presence: true
validates :date, presence: true
validates :amount, numericality: true, presence: true
end
|
# coding: utf-8
require 'fileutils'
require 'logger'
require_relative '../excel_to_code'
# Used to throw normally fatal errors
class ExcelToCodeException < Exception; end
class VersionedFileNotFoundException < Exception; end
class XMLFileNotFoundException < Exception; end
class ExcelToX
# Required attribute. The... |
require 'singleton'
class VoiceService
def generate_text_response(message:)
twiml = Twilio::TwiML::VoiceResponse.new
twiml.say(message, voice: 'woman')
twiml.to_s
end
def dial_number(phone_number:)
twiml = Twilio::TwiML::VoiceResponse.new
twiml.dial do |dial|
dial.number(phone_number)
... |
class AddFieldsToCoop < ActiveRecord::Migration
def change
add_column :coops, :weeks, :integer
add_column :coops, :term, :string
end
end
|
require 'sprockets/asset'
require 'sprockets/bower'
require 'sprockets/errors'
require 'sprockets/resolve'
require 'sprockets/server'
require 'sprockets/legacy'
module Sprockets
# `Base` class for `Environment` and `Cached`.
class Base
include PathUtils, HTTPUtils
include Configuration
include Server
... |
# coding: utf-8
require 'fileutils'
require 'webster'
require 'fauxhai'
require 'excon'
ES_URL = 'https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.tar.gz'
ES_IMAGE = File.basename(ES_URL)
KIBANA_URL = 'https://download.elasticsearch.org/kibana/kibana/kibana-3.1.0.tar.gz'
... |
RSpec.describe "Arabic2English" do
require_relative 'numbers'
NUMBERS.each do |number, text|
it "passing #{number} returns #{text}" do
expect(number.to_english).to eq(text)
end
end
end |
class Admins::OrdersController < ApplicationController
before_action :authenticate_admin!
def index
@customer_id = params[:customer_id]
if @customer_id.blank?
@orders = Order.page(params[:page])
else
@customer = Customer.with_deleted.find(@customer_id)
@orders = Order.where(customer_id: @customer_id).p... |
require 'rails_helper'
describe Employee do
let(:employee) { FactoryGirl.create(:employee) }
subject { employee }
# shoulda gems allows this syntax
it { should have_many(:check_ins) }
it { should have_many(:sick_days) }
it { should have_many(:holiday_requests) }
it { should validate_presence_of(:email... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
#Virtual Machine Box Base
config.vm.box = "bento/ubuntu-20.04"
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |vb|
vb.memory = 1024
vb.cpus = 1
end
#Set commands for both virtual machines
config... |
module Drupal
class MenuLink < Base
set_primary_key "mlid"
serializes "options"
belongs_to :menu_router, :foreign_key => "router_path", :class_name => "Drupal::MenuRouter"
def title
link_title
end
def path
@path ||= Drupal::UrlAlias.url_for(link_path)
end
end
end
|
class AddSlugsToEthnicities < ActiveRecord::Migration
def change
add_column :ethnicities, :slug, :string
end
end
|
require 'spec_helper'
describe 'Topページ' do
it 'は未ログインユーザはアクセス出来ない' do
visit new_event_path
expect(page).to have_content('Welcome to SUL')
end
describe 'GET /' do
before(:each) do
sign_in FG.create(:user)
visit root_path
end
it 'はイベント一覧ページと支払いページへのボタンが表示される' do
expect(page)... |
require 'rails_helper'
describe MedianExpenditure, type: :model do
it { should respond_to(:school_type) }
it { should respond_to(:state) }
context "median expenditure methods" do
context ".find_totals_by_school_type" do
it "returns a hash with charter and non-charter data per state" do
state1 ... |
require 'sinatra'
class App < Sinatra::Application
get '/' do
erb :index
end
post '/submit' do
Sidekiq::Client.enqueue(AlchemyProcessorWorker, params['feed_url'])
redirect '/result'
end
def kibana_url
"http://#{ENV['KIBANA_HOST']}:5601/app" + '/kibana#/discover'
end
get '/result' do
... |
#{{{ Marathon Fixture
require 'default'
#}}} Marathon Fixture
require 'assertions/assert_settings'
require 'settings/on_setting_window'
def test
java_recorded_version = '1.6.0_20'
original_join_area_network = expected_join_area_network = get_setting('JoinAreaNetwork')
original_area_network_name... |
# Solves a board using Lee but sequentially.
# Before we activate Bundler, make sure gems are installed.
Dir.chdir(__dir__) do
chruby_stanza = ""
if ENV['RUBY_ROOT']
ruby_name = ENV['RUBY_ROOT'].split("/")[-1]
chruby_stanza = "chruby #{ruby_name} && "
end
# Source Shopify-located chruby if it exists t... |
require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
test "should not save user without name" do
user = User.create(first_name: "", last_name: "test", email:"test", password: "test")
assert_not user.save
end
test "should not save user with jus... |
class QuestionsController < ApplicationController
def index
@questions = Question.order(created_at: :desc)
end
def show
@question = Question.find(params[:id])
end
def new
@question = Question.new
end
def create
@question = Question.new(question_params)
... |
class AddVestToUserWallets < ActiveRecord::Migration[5.0]
def change
add_reference :user_wallets, :vest, foreign_key: true
end
end
|
require_relative('../db/sql_runner')
require_relative('./artist')
class Album
attr_reader :id
attr_accessor :title, :genre, :artist_id
def initialize(options)
@id = options['id'].to_i unless options['id'] == nil
@title = options['title']
@genre = options['genre']
@artist_id = options['artist_id']... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.