text stringlengths 10 2.61M |
|---|
require 'pry'
class School
def initialize(name)
@name = name
@roster = Hash.new
end
def add_student(name,grade)
if @roster.include?(grade)
@roster[grade] << name
else
@roster[grade] = []
@roster[grade] << name
end
... |
require 'spec_helper'
describe Spree::ToFriendMailer do
let!(:product) { create(:product) }
context 'mail content' do
let(:mail_object) { build(:mail, hide_recipients: true) }
let(:email) { Spree::ToFriendMailer.mail_to_friend(product, mail_object) }
it 'is reply to the sender email' do
e... |
class Queries::Articles::Search < GraphQL::Schema::Resolver
graphql_name 'Search Articles'
description '記事をキーワード検索で絞り込む'
type [Types::ArticleType], null: false
argument :keyword, String, required: true
def resolve(keyword:)
Article.includes(:user).search(keyword).order(created_at: :desc)
end
end
|
class RenameColumnToPayment < ActiveRecord::Migration[5.0]
def change
rename_column :payments, :amount_paid, :amount_cents
end
end
|
#!/usr/bin/ruby
def setup_dotfiles(config)
system("clear")
puts("#=== setting dotfiles ===")
oh_my_zsh()
dotfiles_git = "https://github.com/lucastercas/dotfiles"
system("rm -rf ${HOME}/.cfg")
system("git clone --bare #{dotfiles_git} ${HOME}/.cfg")
system("git --git-dir=${HOME}/.cfg --work-tree=${HO... |
# -*- coding: utf-8 -*-
require_relative 'list'
module MIKU
class Cons
include List
include Enumerable
attr_reader(:car, :cdr)
def self.list(*nodes)
unless nodes.empty?
carnode, *cdrnode = *nodes
Cons.new(carnode, list(*cdrnode))
end
end
def initialize(car, cdr=... |
require 'rails_helper'
describe 'categories listing page' do
it 'tells me that there are no categories' do
visit '/categories'
expect(page).to have_content 'No categories yet'
end
# No longer valid as categories need to have images
# context 'with categories' do
# before do
# Category.create(title: 'B... |
class Admin::UsersController < Admin::BaseController
before_action :load_user, only: :destroy
def destroy
if @user.destroy
flash[:sucess] = t ".user_deleted"
else
flash[:danger] = t "cant_delete"
end
redirect_to users_path
end
private
def load_user
@user = User.find_by id: p... |
require 'test/unit'
require_relative '../../services/route_generator'
require_relative '../../models/stop'
require_relative '../../models/point'
class RouteGeneratorTest < Test::Unit::TestCase
def test_gen_id_with_repeat
route_gen = RouteGenerator.new
route_gen.info_list = ["Escazu - Santa Ana", "Escazu - S... |
module IGMarkets
# Contains details on a working order. Returned by {DealingPlatform::WorkingOrderMethods#all} and
# {DealingPlatform::WorkingOrderMethods#[]}.
class WorkingOrder < Model
attribute :created_date, DateTime, format: '%Y/%m/%d %H:%M:%S:%L'
attribute :created_date_utc, DateTime, format: '%Y-%m... |
# Write a function that takes in a string, and returns true/false if it is a palindrome
# A palindrome is a phrase like "race car". Forward and back it's the same word
# race car
# rac ecar
# racecar
# racecar
def is_palindrome?(string)
no_spaces_input = string.gsub(" ","") # 5
lowercase_no_spaces_input = no_spa... |
# == Schema Information
#
# Table name: identities
#
# id :integer not null, primary key
# extern_uid :string(255)
# provider :string(255)
# user_id :integer
# created_at :datetime
# updated_at :datetime
#
require 'spec_helper'
RSpec.describe Identity, models: true do
describe 'relation... |
module SensuPluginSpec
module Helper
def set_script(script)
@script = script
end
def run_script(*args)
IO.popen(([@script] + args).join(" "), "r+") do |child|
child.read
end
end
def run_script_with_input(input, *args)
IO.popen(([@script] + args).join(" "), "r+") d... |
describe Rovfer::Parser do
let(:ovf_path) { 'spec/fixtures/base-build3.ovf' }
let(:parser) { Rovfer::Parser.new(open( ovf_path )) }
it 'can parse an ovf xml file' do
expect(parser.references).to include('base-build3-disk1.vmdk')
end
it 'can format an xpath query' do
expect(parser.get_in_envelope('Re... |
#!/usr/bin/ruby
require 'nventory'
require 'time'
require 'optparse'
ETCH_SERVER_TZ = 'UTC' # The etch servers run in UTC
options = {}
opts = OptionParser.new
opts.banner = 'Usage: etch_to_trunk [options] <server1> [<server2> <server3>]'
opts.on('-u', '--username USERNAME', 'Username for connecting to nventory se... |
class Api::V1::UsersController < ApplicationController
before_action :find_user, only: [:show]
def index
@users = User.all
render json: @users, status: 200
end
def show
@user = User.find(params[:id])
render json: @user
end
def update
if stale?(last_modified: @user.updated_at, public... |
require 'rails_helper'
RSpec.describe PagesController, type: :controller do
describe 'GET #show' do
let!(:page) { Fabricate(:page, title: 'My Page') }
it 'Gets a page' do
get :show, params: { id: page.slug }
expect(controller.page).to eq(page)
end
end
end
|
class Victim < ActiveRecord::Base
has_many :victim_zombies
has_many :zombies, through: :victim_zombies
end |
require 'spec_helper'
describe Navigation::SectionStepStrategy do
describe "#next" do
it "returns the path to the next step" do
section = FactoryGirl.create(:section_with_steps)
step = section.section_steps.rank(:row_order).first
s = Navigation::SectionStepStrategy.new(step, User.new)
pa... |
class Category < ActiveRecord::Base
has_many :brand_categories, dependent: :destroy
has_many :brands,through: :brand_categories
has_many :sub_categories, class_name: "Category", foreign_key: "parent_id"
belongs_to :parent, class_name: "Category"
has_many :product_categories, dependent: :destroy
has_many :pr... |
class MicropostsController < ApplicationController
before_action :authenticate_user!, only: %i[new create destroy]
before_action :correct_user, only: [:destroy]
def new
@micropost = current_user.microposts.build if user_signed_in?
end
#
# 新規投稿を行う
# get_exifで投稿された画像のexif情報を取得する
# @param [Object] mi... |
class Api::InitiativesController < ApplicationController
def index
@initiatives = Initiative.all
end
end
|
class Mission < ApplicationRecord
belongs_to :job_category
belongs_to :user
has_many :bookings
validates :name, :description, :address, :price_by_hour, :start_date_time, :end_date_time, presence: true
has_many_attached :photos
geocoded_by :address
after_validation :geocode, if: :will_save_change_to_addres... |
module Authenticate_user
include Response
def user_loged_in
json_response("log in!", :unauthorized)
end
end
|
class CalculatorVC < UITableViewController
Description = t("calculator_description")
Information = t("calculator_information")
Warning = t("calculator_warning")
Types = [
["Moose F", 5],
["Moose S", 4],
["Moose RDM", 10],
]
PerLiter = [5, 4, 10, 5]
attr_accessor :delegate
def v... |
class Subscriber < ActiveRecord::Base
validates :email, :presence => true,
:uniqueness => true,
:email => true
#disabled while importing?
after_create :add_to_list
private
def add_to_list
# http://www.campaignmonitor.com/api/subscribers/#adding_a_subscriber
... |
# frozen_string_literal: true
require 'router_extensions/partialize'
require 'router_extensions/subdomain'
module RouterExtensions
class Railtie < ::Rails::Railtie
initializer 'router_exntesions', after: 'action_dispatch.configure' do
ActionDispatch::Routing::Mapper.include RouterExtensions::Partialize
... |
# rubocop:disable Metrics/LineLength
# rubocop:disable Metrics/PerceivedComplexity
# rubocop:disable Metrics/CyclomaticComplexity
module SDP
module Importers
class NestedItem
attr_accessor :name, :type, :items, :data_element, :de_tab_name
def initialize(type = :data_element)
@name = name
... |
require 'rails_helper'
describe Project do
describe :all do
let(:tasks) do
[{
id: 1,
name: "Milk"
},
{
id: 2,
name: "Bread"
},
{
id: 3,
name: "Butter"
}]
end
let(:projects) do
[{
id: 1,
name: "Shop l... |
require 'os_path'
require OSPath.path("modules/fitness.rb")
require 'population_monitor.rb'
class Genome
def initialize(genes)
@genes = genes
end
def sequence
@genes
end
end
class RandomSearch
include Fitness
def initialize
@config={
:fitness_function => :sim_eq_1,
:pop_mon... |
# 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
before_filter :meta_defaults
helper :all # include all helpers, all the time
protect_from_forgery
lay... |
FactoryGirl.define do
factory :translation do
value 'Test text'
language
word
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... |
class ContactFormPresenter < ApplicationPresenter
def initialize(attributes={})
@errors = ActiveModel::Errors.new(self)
@name = attributes['name']
end
attr_accessor :name
attr_reader :errors
def validate!
errors.add(:name, :blank, message: "cannot be nil") if name.nil?
end... |
class RenameColumnFromPriceToQuote < ActiveRecord::Migration[5.2]
def change
rename_column :bids, :price, :quote
end
end
|
class ApplicationController < ActionController::Base
# rescue_from ::ActiveRecord::RecordNotFound, with: :record_not_found
# rescue_from ::NameError, with: :error_occurred
# rescue_from ::ActionController::RoutingError, with: :error_occurred
# # rescue_from ::Exception, with: :error_occurred
# protected
#... |
class DropUserFromRsvp < ActiveRecord::Migration[5.1]
def change
remove_column :rsvps , :user_id
add_column :rsvps, :attender_id, :integer
end
end
|
class Article < ActiveRecord::Base
has_attached_file :cover, styles: { slide: '1366x768', standar: '728x728' , medium: '100x100', mini: '100x200', icono: '70x70', principal: '1920x377' },
:storage => :s3,
:s3_credentials => Proc.new{|a| a.instance.s3_credentials }
validates_attachment_content_type :cov... |
json.array!(@day_aheads) do |day_ahead|
json.extract! day_ahead, :id, :prosumer_id, :date
json.url day_ahead_url(day_ahead, format: :json)
end
|
require_dependency "onboard_datax/application_controller"
module OnboardDatax
class OnboardEngineConfigsController < ApplicationController
before_filter :require_employee
before_filter :load_record
def index
@title = t('Onboard Engine Configs')
@onboard_engine_configs = params[:onboard_... |
class CreateAgentAccounts < ActiveRecord::Migration[6.1]
def change
create_table :agent_accounts do |t|
t.string :company_name
t.decimal :money_in, default: 0
t.decimal :money_out, default: 0
t.decimal :commission_earned, default: 0
t.decimal :payin_amount_due, ... |
class Luhn
def initialize(number)
@number = number
end
def checksum
codes = []
# reverse the number and split it to single digits, make each vlaue a number and then do with index
@number.to_s.reverse.split('').map(&:to_i).each_with_index do |n, i|
# multiply the number by 2 of it's index i... |
module ApplicationHelper
def error_messages_for(resource)
render "shared/error_messages", :resource => resource
end
def days_of_week()
[:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday]
end
end
|
require 'bcrypt'
class User < ActiveRecord::Base
include BCrypt
has_many :external_links, as: :linkable
has_many :pitches
has_many :votes
has_many :comments
has_many :subcomments
validates :first_name, :last_name, presence: true
validates :email, uniqueness: true
validates :blurb, length: { maximum... |
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2021-2022, by Samuel Williams.
require 'console/logger'
require 'console/capture'
describe Console::Output::Default do
let(:output) {Console::Capture.new}
let(:logger) {subject.new(output)}
def final_output(output)
if output.respond_... |
class RelaxOrderConstraints < ActiveRecord::Migration
def up
change_column :orders, :customer_name, :string, limit: 50, null: true
change_column :orders, :shipping_address_id, :int, null: true
end
def down
change_column :orders, :customer_name, :string, limit: 50, null: false
change_column :order... |
require 'minitest/spec'
require 'minitest/autorun'
require './lexer'
require './parser'
require './errors'
example_saf = ""
File.open("./test/example.saf", "r") do |f|
example_saf = f.read
end
describe Sapphire::Parser do
it "should start with a nil lexer" do
p = Sapphire::Parser.new
p.lexer.mus... |
require 'sinatra'
class Time
def to_datetime
# Convert seconds + microseconds into a fractional number of seconds
seconds = sec + Rational(usec, 10**6)
# Convert a UTC offset measured in minutes to one measured in a
# fraction of a day.
offset = Rational(utc_offset, 60 * 60 * 24)
DateTime.ne... |
class ApplicationController < ActionController::Base
# protect_from_forgery with: :exception
# before_action :configure_permitted_parameters, if: :devise_controller?
before_action :convert_user_params
acts_as_token_authentication_handler_for User, fallback: :none
# respond_to :json
def require_user
if !... |
require 'byebug'
require 'bcrypt'
require 'jwt'
require "date"
module WebToken
class WebtokenValidate
def validate( token )
begin
decoded_token = JWT.decode token, nil, false
rescue JWT::ExpiredSignature
rescue JWT::ImmatureSignature
rescue JWT::DecodeError
end
if decoded... |
class LinkedList
def initialize
@tail = nil
@head = @tail
@length = 0
end
private
def to_end(node)
while node.next_node != @tail
node = node.next_node
end
return node
end
public
def append(value)
if @head == @tail
@head = Node.new(value, @tail)
else
current_node = @head
current_node =... |
class Condition
attr_accessor :operator
attr_accessor :number
def initialize(operator, number)
@operator = operator.strip
@number = number
end
def [](value)
case @operator
when '>'
return value > @number
when '<'
return value < @number
when '<='
return value <= @number
when '>='
... |
require_relative "test_helper"
describe "channel" do
describe "self.list" do
it "Returns an array of hashes" do
VCR.use_cassette("self.list") do
channel_list = SlackBot::Channel.list
expect(channel_list).must_be_kind_of Array
expect(channel_list.first).must_be_kind_of SlackBot::Cha... |
require 'spec_helper'
describe Meshblu::Client do
before :each do
@sut = Meshblu::Client::Base.new(
:host => 'http://example.com',
:uuid => 'some-uuid',
:token => 'token',
)
end
describe '.new' do
it 'set the host' do
expect(@sut.host).to eq 'ht... |
require 'rails_helper'
RSpec.describe Broker, type: :model do
describe 'creation' do
it 'can t be created without Siren' do
broker = Broker.create(name: "testbroker")
expect(broker).not_to be_valid
end
it 'can t be created with a Siren s size different than 9' do
broker = Broker.create... |
require 'sources'
require 'ostruct'
require 'deploy/aws/s3_upload'
module Deploying
def parse(args)
options = OpenStruct.new
options.region = 'us-east-1'
options.bucket = 'deploy.fineo.io/lambda'
options.source = "build.json"
options.output = "updates.json"
OptionParser.new do |opts|
... |
Puppet::Type.newtype(:octopusdeploy_tentacle) do
@doc = 'Ensures an Octopus Deploy tentacle is configured'
newproperty(:ensure) do
desc 'Specifies whether the tentacle should be present or absent.
Note that this will not install or uninstall the tentacle Windows Service, just the configurat... |
# frozen_string_literal: true
require "rails_helper"
module Renalware
module Diaverum
module Incoming
RSpec.describe SaveSession do
include DiaverumHelpers
include Diaverum::ConfigurationHelpers
subject(:service) do
described_class.new(
patient: patient,
... |
# ==========================================================================
# Project: Lebowski Framework - The SproutCore Test Automation Framework
# License: Licensed under MIT license (see License.txt)
# ==========================================================================
module Lebowski
module Foundat... |
# frozen_string_literal: true
module Admin
describe FinancialEntriesController do
include_context 'when user logged', :manager
let(:model_class) { FinancialEntry }
let(:model_name) { h.tm(FinancialEntry) }
let(:financial_entry_field_names) { [:user_id, :content_file] }
describe 'GET new' do
... |
class WelcomeController < ApplicationController
before_action :authenticate_user, only: [:new_user,:save_user]
def index
end
def new_user
end
def save_user
@user = User.new
@email = params[:email]
@password = params[:pass]
@pass_confirm = params[:pass_confirm]
if @password == @pass_confirm
@use... |
class CollectionLikeValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors[attribute] << 'is not a collection' unless value.respond_to?(:each)
end
end
|
class RemoveBodyFromEpisodes < ActiveRecord::Migration
def change
remove_column :episodes, :body, :text
end
end
|
FactoryGirl.define do
factory :old_customer, :class => 'Customer' do
transient do
role :patron
created_by_admin false
end
sequence(:first_name) { |n| "Jack#{n}" }
sequence(:last_name) { |n| "Wan#{n}" }
sequence(:email) { |n| "jack#{n}@qq.com" }
sequence(:password) { |n| "old_pass#{... |
Pod::Spec.new do |s|
s.name = "TMPhotoBrowerView"
s.version = "1.0"
s.summary = "photo brower"
s.description = <<-DESC
photo brower view
DESC
s.homepage = "https://github.com/tangshimi/TMPhotoBrowerView"
s.license = { :type => 'Copyright',
... |
# == Schema Information
#
# Table name: schedule_layers
#
# id :integer not null, primary key
# duration :integer
# rule :string(255) default("daily"), not null
# count :integer default(1), not null
# position :integer
# uuid :string(255)
# schedule_id :i... |
class AddCatgoriaIdToProductos < ActiveRecord::Migration
def change
add_reference :productos, :categoria, index: true
end
end
|
#!/usr/bin/env ruby
if ARGV.length < 1
print "MKV repacker script"
print " Usage: mkv2avi file(s)"
else
ARGV.each do |file|
puts "Unpacking file #{file}"
system("mkvextract tracks #{file} 1:temp_video.avi 2:temp_audio.ogg")
puts "Unpacking file #{file}"
system("ffmpeg -i temp_audio.ogg -i temp_... |
module RSpec
module Mocks
RSpec.describe "A method stub" do
before(:each) do
@class = Class.new do
class << self
def existing_class_method
existing_private_class_method
end
private
def existing_private_class_method
... |
require File.dirname(__FILE__) + '/../test_helper'
class NotificationListenersControllerTest < ActionController::TestCase
def test_should_get_index
get :index
assert_response :success
assert_not_nil assigns(:notification_listeners)
end
def test_should_get_new
get :new
assert_response :succes... |
require_relative '../../db/config'
require 'date'
class Student < ActiveRecord::Base
has_and_belongs_to_many :teachers
validates :email, :format => { :with => /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/,
:message => "Must have valid email address" }
validates :email, :uniqueness ... |
require 'rails_helper'
RSpec.describe Payment, type: :model do
it { expect(subject).to have_db_column(:amount) }
it { expect(subject).to belong_to(:client) }
it { expect(subject).to validate_presence_of(:client) }
it { expect(subject).to have_one(:payment_history) }
end
|
class Portecle < FPM::Cookery::Recipe
description 'user friendly GUI application for creating, managing and examining keystores'
name 'portecle'
version '1.11'
revision '0'
homepage 'https://github.com/scop/portecle'
source "https://github.com/scop/portecle/releases/download/v#{version}/portecle-#{version... |
module Todoable
# Methods for the Items Endpoints
class Item
LISTS_PATH = "/lists".freeze
attr_accessor :list, :name, :id, :finished_at
def initialize(list, options={})
@list = list
options.each do |key, value|
send("#{key}=", value)
end
end
def mark_finished
p... |
# frozen_string_literal: true
require 'rails_helper'
feature '管理画面:シーズン、曲の画像', js: true do
let!(:user) { create(:user, :registered, :admin_user) }
let!(:melody) { create(:melody, :with_season) }
background do
login(user)
end
context '曲に画像が登録されていた場合' do
let!(:melody_image1) { create(:melody_image, ... |
require 'semantic_logger'
module GhBbAudit
class RepoScanner
include SemanticLogger::Loggable
def initialize(options)
@user_csv_path = options[:user_file_path]
@keyword_csv_path = options[:keywords_file_path]
@output_file_path = options[:output_file_path]
::GhBbAudit::Github::GithubApi... |
class User < ApplicationRecord
has_secure_password
before_save { |user| user.username = username.downcase }
# has many relation with pins
has_many :pins, :dependent => :destroy
validates :name, presence: true, length: { maximum: 50 }
validates_uniqueness_of :username, :case_sensitive => false
before_save { ... |
class RenameApplicationTemplateDraftToApplicationDraft < ActiveRecord::Migration
def change
rename_table :application_template_drafts, :application_drafts
end
end
|
class FileGroupsController < ApplicationController
before_action :require_medusa_user, except: [:show, :content_type_manifest]
before_action :require_medusa_user_or_basic_auth, only: [:show, :content_type_manifest]
before_action :find_file_group_and_collection, only: [:show, :destroy, :edit, :update, :create_cfs... |
# -*- coding: utf-8 -*-
# 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 ActionContr... |
class PrintersController < ApplicationController
before_action :colaborador
layout 'system/navbar'
def index
@printers = Printer.all
@printer_new = Printer.new
end
def create
@printer_new = Printer.create(printer_params)
if @printer_new.modelo == 'Outro'
@printer_new.modelo = @printer_new.modelo_aux
... |
# frozen_string_literal: true
class RoomUser < ApplicationRecord
belongs_to :user
belongs_to :room
belongs_to :last_read_message, class_name: 'Message', foreign_key: :last_read_message_id, optional: true
def self.create_or_update!(room_id, user_id, last_read_message_id)
item = find_by(room_id: room_id, use... |
class ResponsesController < ApplicationController
def new
@question = Question.find(params[:question_id]) if params[:question_id]
@question ||= Question.where(:status => "open").limit(1).first
redirect_to no_hits_responses_path unless @question
@response = @question.responses.new
@disabled = Turkee::Turkee... |
class StaffUsersController < ApplicationController
layout "staff"
before_filter :confirm_logged_in
def index
@staff_users = StaffUser.order("staff_users.last_name, staff_users.first_name ASC")
end
def show
end
def new
@staff_user = StaffUser.new
end
def create
@staff_user = StaffUser.new(par... |
class UtilitySharing < ActiveRecord::Base
PERMISSION_LEVELS = {
'View only' => 'read',
'View and add bills' => 'read_write'
}.freeze
belongs_to :utility
belongs_to :user
validates :utility, :user, :permission_level, presence: true
validates :permission_level, inclusion: {in: PERMISSION_LEVELS.val... |
class Response < ActiveRecord::Base
attr_accessor :content, :form, :properties
def initialize content, form, properties={}
self.content = content
self.form = form
self.properties = properties
end
def self.describe text
Response.new text, 'description'
end
def self.command_error command, i... |
class AddColumnsToReviews < ActiveRecord::Migration[5.0]
def change
add_column :reviews, :user_content, :text
add_column :reviews, :gear_content, :text
remove_column :reviews, :content
end
end
|
class TypeOfLossDecorator < Draper::Decorator
delegate_all
def title
h.link_to object.title, h.edit_type_of_loss_path(object)
end
def relevance
h.check_box_tag 'type_of_losses[]', object.relevance , object.relevance,{ :disabled => "disabled"}
end
#
# def first_name
# h.link_to object.first... |
class CreateBagProperties < ActiveRecord::Migration
def self.up
create_table :bag_properties do |t|
t.integer "bag_id", :default => 1
t.string "name"
t.string "label"
t.integer "data_type", :default => 1
t.string "display_type", :default => 'text'
t.boolean "required", :default... |
class CreateBillingDetails < ActiveRecord::Migration
def change
create_table :billing_details do |t|
t.integer :address_id
t.integer :user_id
t.integer :user_details
t.string :card_no
t.string :card_type
t.boolean :status
t.string :paid_amount
t.string :transactio... |
class CustomException < StandardError
def initialize(msg = "an exception has occurred", exception_type = "custom")
@exception_type = exception_type
super(msg)
end
def exception_type
@exception_type
end
end
|
FactoryBot.define do
factory :client do
email { Faker::Internet.email }
password { Faker::Internet.password }
phone { Faker::PhoneNumber.cell_phone }
fullname { Faker::Name.name }
end
end
|
require 'rails_helper'
RSpec.describe 'Merchant edit coupon' do
describe 'as a merchant employee' do
before :each do
@merchant_1 = create :merchant
@merchant_user = create :random_merchant_user, merchant: @merchant_1
@coupon = create :coupon, merchant: @merchant_1
@coupon_2 = create :coup... |
class MomentParticipant < ActiveRecord::Base
belongs_to :moment
belongs_to :participant
end
|
class AddContractVersionToConsultants < ActiveRecord::Migration
def change
add_column :consultants, :contract_version, :string
Consultant.where("contract_effective_date is not null").update_all(contract_version: "v1")
end
end
|
require 'spec_helper'
describe Harvestime::Day do
describe "#total" do
subject { Harvestime::Day.new(lines).total }
context "with no lines" do
let(:lines) { [] }
it { should be_nil }
end
context "with one line" do
let(:lines) { [stub(:time_difference => " 0:32")] }
it "is the ... |
require 'active_record'
require 'hydramata/works/predicates'
require 'hydramata/works/predicate_presentation_sequences/storage'
require 'hydramata/works/predicate_sets/storage'
require 'hydramata/works/work_types/storage'
module Hydramata
module Works
module Predicates
# I don't want to conflate the idea w... |
require File.expand_path('../../spec_helper', __FILE__)
describe Rack::Chain do
let(:env) { Hash.new }
let(:app) { app_dummy.new }
let(:chain) { Rack::Chain.new(app) }
let(:filter_names) { %w(Foo Bar Baz) }
let(:filters) { filter_names.map {|x| filter_dummy(x) } }
let(:full_chain) { chain.tap {|c| c.f... |
require "formula"
class Opencc < Formula
homepage "https://github.com/BYVoid/OpenCC"
url "http://dl.bintray.com/byvoid/opencc/opencc-1.0.2.tar.gz"
sha1 "101b9f46aca95d2039a955572c394ca6bdb2d88d"
bottle do
sha1 "f49556768692c346a700382cec6746ee3d425ff3" => :yosemite
sha1 "e7024a546b9b322a5cdb43703004a9... |
module Squall
# OnApp Template
class Template < Base
# Return a list of available Templates
def list
response = request(:get, '/templates.json')
response.collect { |temp| temp['image_template'] }
end
# Make a Template public so that it can be downloaded
# via a HTTP url
#
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.