text stringlengths 10 2.61M |
|---|
class Topic < ActiveRecord::Base
belongs_to :user
has_many :votes, :class_name => "TopicVote"
has_many :debates
def to_param
[id, title.parameterize].join("-")
end
def score
collected_votes = self.votes
score = 0
collected_votes.each do |vote|
score += vote.value
end
ret... |
describe OAuth::Facebook do
describe '.authorization_url' do
it 'returns the full authorization url' do
expect(described_class.authorization_url)
.to include({ client_id: Configuration.FACEBOOK_CLIENT_ID }.to_query)
.and include({ redirect_uri: Configuration.FACEBOOK_REDIRECT_URI }.to_query... |
class Admins::TagsController < ApplicationController
before_action :authenticate_admin!
def index
@tags = Tag.all
@tag = Tag.new
end
def edit
@tag = Tag.find(params[:id])
end
def update
@tag = Tag.find(params[:id])
@tag.update(tag_params)
redirect_to admins_tags_path
end
private
def ta... |
class Tag < ActiveRecord::Base
has_many :taggings
validates_presence_of :name
validates_uniqueness_of :name
class << self
delegate :delimiter, :delimiter=, :to => TagList
end
def ==(object)
super || (object.is_a?(Tag) && name == object.name)
end
def to_s
name
end
def count... |
require 'acceptance/acceptance_helper'
feature 'Task feature', %q{
In order to manage tasks
As an authenticated user
I want to list, create, update, destroy tasks
} do
before(:each) do
@user = create_admin_user
@pending = TaskStatusType.create({name: 'Pending', description: 'blah', created_by: @user... |
# write a method that returns an Array that contains
# every other element of an array
# that is passed in as an argument
# the values in the returned list should be those values that are in
# the 1st, 3rd, 5th, and so on elements of the argument array
# Examples:
#
# oddities([2, 3, 4, 5, 6]) == [2, 4, 6]
# odditie... |
module Opium
module Celluloid
class Mailbox < ::Celluloid::Mailbox
def initialize(history = nil)
@history = history
super()
end
def <<(message)
unless message.is_a?(::Celluloid::SystemEvent)
opium_message = Opium::Message.new(message.method, message.arguments)
... |
require 'rails_helper'
RSpec.describe Multimedia, type: :model do
describe "Multimedia validations" do
it { should validate_presence_of(:category)}
it { should validate_presence_of(:user)}
end
describe "Multimedia associations" do
it { belong_to(:category) }
it { belong_to(:user) }
end
descr... |
module Drivy::Lint
module Config
class ScssLint < Base
def scss_lint_config
@scss_lint_config ||= begin
content = Octokit.content(@commit.repo, path: '.scss-lint.yml', ref: @commit.sha)
content = Base64.decode64(content.content).force_encoding('UTF-8')
config_hash = YAM... |
require 'rails_helper'
RSpec.describe ClientSegment, type: :model do
it 'has a valid factory' do
expect(create :client_segment).to be_valid
end
it { should belong_to :client }
it { should have_many :words_keys }
end
|
# Add the following methods to this burrito class and
# call the methods below the class:
# 1. add_topping
# 2. remove_topping
# 3. change_protein
class Burrito
attr_reader :protein, :base, :toppings
attr_accessor :add_topping, :remove_topping, :change_protein
def initialize(protein, base, toppings)
@pro... |
class SubscriptionsController < ApplicationController
def create
parent_obj = params[:parent_obj_type].constantize.find_by( id: params[:parent_obj_id] )
@sub = Subscription.new( user: current_user, parent_obj: parent_obj )
if @sub.save
flash[:notice] = "Subscription added."
else
flash[:e... |
class JobApplication < ApplicationRecord
belongs_to :job
belongs_to :user, -> { where role: 'applicant' }
default_scope -> { order created_at: :desc }
end
|
# frozen_string_literal: true
require 'jiji/configurations/mongoid_configuration'
module Jiji::Model::Trading::Brokers
class AbstractBroker
include Jiji::Model::Trading
attr_reader :positions #:nodoc:
# 口座情報
attr_reader :account
def initialize #:nodoc:
@positions_is_dirty = true
@... |
class Assignment < ActiveRecord::Base
attr_accessible :assigned_by, :date_accepted, :document_id, :user_id
belongs_to :user
delegate :name, :to => :user, :prefix => true
belongs_to :document
def new_document
@new_document ||= self.document.is_childless? ? self.document : self.document.children.last... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'carnival/version'
Gem::Specification.new do |spec|
spec.name = "carnival"
spec.version = Carnival::VERSION
spec.authors = ["Lukas Diener"]
spec.email = ["luka... |
require 'rails_helper'
RSpec.feature "Contact user", type: :feature do
let(:user) { create(:user) }
let(:category) { create(:category, name: 'Arts', branch: 'hobby') }
let(:post) { create(:post, category_id: category.id) }
context "Logged in user" do
before :each do
sign_in user
end
scenari... |
module LegalServices
class Lot
include StaticRecord
attr_accessor :number, :description
def self.[](number)
Lot.find_by(number: number)
end
def self.all_numbers
all.map(&:number) + sublot_numbers
end
def self.sublot_numbers
['2a', '2b', '2c']
end
end
Lot.load... |
class Product < ActiveRecord::Base
validates :name, :origin, :brand, :url, :presence => true
validates :cost, numericality: true, :presence => true
has_many :reviews, dependent: :destroy
scope :newest_products, -> { order(created_at: :desc).limit(3)}
scope :most_reviews, -> {(
select("products.name, pr... |
require 'helper'
describe 'Music' do
describe 'Methods' do
subject { FixMyTags::Music::Basic.new "./random/folders/artist - title.mp3" }
it 'must have name' do
subject.must_respond_to :name
end
it 'must have artist' do
subject.must_respond_to :artist
end
... |
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# -*- ruby -*-
#
require 'rubygems'
require 'rss'
require 'open-uri'
require 'hpricot'
#
# 取得したフィードを配列で返す。
# フィードが無い場合は空配列を返す。
# 指定したURLが無効な場合はnilを返す。
#
require 'feed-normalizer'
def process_rss(rss,list)
content = ''
open(rss){ |f|
content = f.read
}
rss = ... |
require "spec_helper"
module NginxConfigMaker
describe Location do
describe "#to_s" do
context "given proxy pass" do
it "generates location config with proxy_pass" do
config = described_class.new(
at: "/",
proxy: {
pass: "http://app",
}
... |
require 'inflecto'
module ROM
class RelationRegistry
class RelationBuilder
attr_reader :name, :relation, :schema
def initialize(name, schema)
@name = name
@relation = schema[name]
@schema = schema
end
def call(&block)
relations = schema.relations
... |
class Task < ActiveRecord::Base
belongs_to :user
def completed
update(complete: true)
end
end
|
require File.expand_path(File.dirname(__FILE__) + '/../../../test_helper')
class TinyCI::OutputParser::RakeParserTest < ActiveSupport::TestCase
test "should return build report" do
output = TinyCI::Output.new('')
result = TinyCI::OutputParser::RakeParser.parse(output)
assert result.is_a?(TinyCI::Report::... |
class AttributeAssessment < ActiveRecord::Base
belongs_to :assessment_group_batch #check and remove the association
belongs_to :subject_attribute_assessment
belongs_to :subject #check and remove the association
belongs_to :assessment_attribute_profile #check and remove the association
belongs_to :assessment_a... |
class CitiesController < ApplicationController
def show
@city = City.find_by_nicename!(params[:id], :include => :districts)
end
end
|
require "spec_helper"
RSpec.describe "Day 22: Sporifica Virus" do
let(:runner) { Runner.new("2017/22") }
let(:input) do
<<~TXT
..#
#..
...
TXT
end
describe "Part One" do
let(:solution) { runner.execute!(input, part: 1) }
it "calculates the number of infections" do
expe... |
require 'rails_helper'
RSpec.describe Purchase, type: :model do
it '#register' do
purchase_params = {
"purchaser_name" => 'João Silva',
"item_description" => 'R$10 off R$20 of food',
"item_price" => 10.0,
"purchase_count" => 2,
"merchant_address" => '987 Fake St',
"merchant_na... |
module MDS
module Responses
class SingleOrderAck
attr_accessor :body
def initialize(body)
@body = body.to_h
end
def success?
true
end
def message
"#{objects.size} shipments were received."
end
def objects
orders = body['OrderDetai... |
require 'spec_helper'
describe AccessSchema::ConfigBuilder do
it "can define schemas directly from file" do
config = AccessSchema::ConfigBuilder.build do
schema :acl, :file => 'spec/schema_example.rb'
end
config.schema(:acl).roles.should_not be_nil
end
it "can specify logger" do
test_... |
# This file contains functionality to extract information from a TIPR package
# to create a DAITSS SIP.
#
# BUGS: (in templates/daitss_sip.xml.erb) METS StructMap for each representation
# only delves 2 divs deep.
require 'nokogiri'
require 'tipr'
require 'validatable'
require 'valid'
SIPFile = Struct.new(:p... |
class ProgramsController < ApplicationController
before_action :find_computer
before_action :find_program, only: [:update, :destroy]
def index
@programs = @computer.programs
end
def new
@program = @computer.programs.build
#@program = Program.new
end
def create
@program = @computer.progr... |
module Bookable
module Generators
class InstallGenerator < Rails::Generators::Base
argument :resource_name, :type => :string, :default => "resource"
source_root File.expand_path("../", __FILE__)
def install
generate "bookable:resource_model #{resource_name}"
generate "bookable:b... |
require 'spec_helper'
module Neo4j::Server
describe Neo4jServerEndpoint do
let(:response) do
"RESPONSE"
end
let(:url) do
"URL"
end
describe "for requests WITHOUT basic auth" do
before(:each) do
@endpoint = Neo4jServerEndpoint.new()
end
it "should allow HTT... |
class FontPretendardJp < Formula
version "1.3.6"
sha256 "ddf2d0e574ba921bacd5c114c91387340beb31b47bf4347280d3db78879d29d2"
url "https://github.com/orioncactus/pretendard/releases/download/v#{version}/PretendardJP-#{version}.zip"
desc "Pretendard JP"
desc "Alternative font to system-ui for all platforms"
hom... |
# Програма, яка за заданим значенням номера повертає назву планети
class Planet
def echo_planet
puts "Введіть номер планети:"
number = gets.chomp
case number
when '1' then puts "Меркурій"
when '2' then puts "Венера"
when '3' then puts "Земля"
when '4' then puts "Марс"
... |
class Category < ApplicationRecord
# 外部キーとしてarticlesテーブルのcategories_idから参照されている。
has_many :article, class_name: 'Article', foreign_key: 'categories_id'
end
|
require('rspec')
require('jobs')
describe(Jobs) do
describe("#past_job") do
it("lets you enter a job you've had") do
test_job = Jobs.new("Barista", "Fun")
expect(test_job.past_job()).to(eq("Barista"))
end
end
describe("#description") do
it("lets you enter a description of a job you've... |
class Client < ActiveRecord::Base
include PgSearch
has_many :touches
belongs_to :business
multisearchable :against => [:first_name, :last_name, :phone_number, :notes]
#Finds all Touch objects and puts in them in order of their creation
#
#Returns the first Touch object
def most_recent_message
... |
FactoryGirl.define do
factory :product_length do
name "length name"
created_at Time.zone.local(2000,1,1, 0,0,0)
updated_at Time.zone.local(2000,1,1, 0,0,0)
end
end |
class Feedback < ActiveRecord::Base
include FakeDestroy
belongs_to :project
belongs_to :user
validates_presence_of :name, :email, :content
enum status: {submit: 0, processing: 1, done: 2}
end
|
class User < ApplicationRecord
has_many :events, as: :host
has_many :rsvps
has_many :events, through: :rsvps
end
|
# ForadianTestPlugin
require 'action_view/helpers/asset_tag_helper'
class FedenaTheme
COLORS = {1 => {:color => "#701288",:accent_color => "#4e0d5f",:border_color => "#8d41a0",:sort_order => 16},
2 => {:color => "#39a6ef",:accent_color => "#2874a7",:border_color => "#61b8f2",:sort_order => 24},
... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most comm... |
module JsonTableSchema
module Types
class String < Base
def name
'string'
end
def self.supported_constraints
[
'required',
'pattern',
'enum',
'minLength',
'maxLength',
]
end
def type
::String
e... |
# Check for Patreaon contributors
class SetPatreonContributorsJob < ApplicationJob
def perform
patron_ids = Patreon::GetPatronsService.perform
service = Users::SetPatreonContributorsService.new(patron_ids)
service.perform
end
end
|
class User < ApplicationRecord
validates :email, uniqueness: true
validates_format_of :email, with: /@/
validates :password_digest, presence: true
# Pass the hard work of password processing off to bcrypt
has_secure_password
# Core relationships
has_many :lists, dependent: :destroy
has_many :todos, th... |
class ChangeColumnsOfJoinTable < ActiveRecord::Migration
def change
rename_column :attributes_sections, :course_id, :section_id
end
end
|
class Example < Object
# This is a comment.
attr_accessor :honorific
attr_accessor :name
attr_accessor :date
def to_s
@name
end
def initialize(name,date)
@name = name
@date = date.nil? ? Date.today : date
end
def titled_name
@honorific ||= 'Esteemed'
titled_name = "#{@honorific} #{@name}"
end
def december_b... |
class Point < ActiveRecord::Base
has_many :options, dependent: :destroy
accepts_nested_attributes_for :options,
:allow_destroy => true, reject_if:
lambda {|attributes| attributes['response'].blank?}
audited
validates :text, presence: true,
length: { minimum: 5 }
... |
require 'cucumber'
require 'selenium-webdriver'
require 'rspec'
Given (/^I open the home page$/) do
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
@homepage = HomePage.new
@homepage.open_url
puts "[LOG]: This page is validated..."
wait = Selenium::WebDriver::Wait.new(:timeout => 10)
end
When (/^I click t... |
module Tinny
module Exception
class InvalidHandlerException < StandardError
def initialize(message = 'Please use a valid data handler. See docs.')
super(message)
end
end
class MissingConfigException < StandardError
def initialize(message = 'Missing/Invalid config block. See docs... |
require "dns_load/version"
module DnsLoad
autoload :Dig, 'dns_load/dig'
VERSION_COPYRIGHT = "v#{VERSION} \u00A9 2013 C. Jason Harrelson"
end
|
require 'rails_helper'
describe "Contentful WebService" do
subject { Contentful::Webservice }
describe "#public methods" do
it "validates client method" do
expect(subject.public_methods.include?(:client)).to eq true
end
end
describe "#client" do
context "connection successfull" do
it ... |
# # Pling Plang Plong
#
# Write a program that converts a number to a string per the following rules:
#
# If the number contains 3 as a factor, output 'Pling'.
# If the number contains 5 as a factor, output 'Plang'.
# If the number contains 7 as a factor, output 'Plong'.
#
# If the number does not contain 3, 5, or 7 as... |
require "html_enumerator"
module PricingCalculator
class HtmlNodesCounter
def initialize(page:)
@page = page
end
def call
nodes.count { |el| el.element? }
end
private
attr_reader :page
def nodes
@nodes ||= HtmlEnumerator.new(page)
end
end
end
|
require 'test_helper'
require 'model_test_helper'
class AgentRegressionChecksControllerTest < ActionDispatch::IntegrationTest
def setup
create_agent_regression_check_fixtures
end
#
# Create
#
test 'Create agent regression checks access' do
sign_in users(:edit_on_agent_weather)
post user_agent_... |
def date_range_picker_params(start_date, end_date)
"#{start_date.strftime('%m/%d/%Y')} - #{end_date.strftime('%m/%d/%Y')}"
end
def date_range_picker_select_range(range_name)
page.find("#filters_date_range").click
within ".ranges" do
page.find("li[data-range-key='#{range_name}']").click
end
end
RSpec.share... |
# == Schema Information
#
# Table name: photos
#
# id :integer not null, primary key
# user_id :integer
# cluster_id :integer
# jpg_asset_id :integer
# name :string(255) default(""), not null
# state :string(255) default(""), not null
# secret :string(8) ... |
class Actor < ApplicationRecord
has_many :actors_movies
has_many :movies, through: :actors_movies
validates presence: true
end
|
# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|
spec.name = "dependency"
spec.version = "0.0.1"
spec.summary = "Depends on stuff to break higher-level deps"
spec.license = "public domain"
spec.authors = "Anonymous"
spec.files = ["empty.rb"]
... |
class HabitsController < ApplicationController
def create
@user = User.find(params[:user_id])
@habit = @user.habits.new(params[:habit])
if @habit.save
redirect_to @user, :notice => "Habit created!"
else
render "new"
end
end
def new
@user = User.find(params[:user_id])
@ha... |
class Robot < ActiveRecord::Base
include HealthManager
include AutoPresentable
belongs_to :code_name
has_many :robot_weapons
has_many :weapons, through: :robot_weapons
has_one :health, as: :machine
validates :code_name, presence: true #, message: "Needs to be a registered robot"
... |
class AddConfirmableToMembers < ActiveRecord::Migration
def changestring
add_column :members, :confirmed_at, :datetime
add_column :members, :confirmation_sent_at, :datetime
add_column :members, :unconfirmed_email, :string
end
end |
require "test_helper"
class OfxFileImporterServiceTest < ActiveSupport::TestCase
setup do
@service = OfxFileImporterService
@ofx_file = file_fixture("valid_statement.ofx").to_path
@another_ofx_file = file_fixture("another_valid_statement.ofx").to_path
@alessandro = users(:alessandro)
end
test "v... |
class WebtoolController < ApplicationController
def render
@template = "render.html.erb"
end
end
|
class CreateBarGameTypes < ActiveRecord::Migration[6.1]
def change
create_table :bar_game_types do |t|
t.string :game_type
t.string :descripton
end
end
end
|
namespace :deploy do
task :mod_group do
on roles :app do
dirs = fetch(:mod_group_directories, [])
dirs.each do |dir|
execute "chgrp #{fetch(:mod_group)} #{shared_path}/#{dir} && chmod g+w #{shared_path}/#{dir}"
info "Group of #{shared_path}/#{dir} chan... |
class Track < ActiveRecord::Base
validates_presence_of :title , :artist , :album
end
|
class ChordGame < ApplicationRecord
has_many :chord_leaderboards
has_many :users, through: :chord_leaderboards
end
|
require_relative '../feature_helper'
feature 'User can see questions list', %q(
In order to find answers to related question
As a user
I want to be able to see list of all questions
) do
scenario 'User goes to questions page' do
@questions = create_list(:question, 3)
visit questions_path
expect(current_... |
class AddVotesCounterToComment < ActiveRecord::Migration[5.0]
def change
add_column :comments, :votes_counter, :integer, default: 0
end
end
|
# ExchangesController for signed in users.
# It allows users to create, delete, update, view his/her currency exchanges
class ExchangesController < ApplicationController
before_action :authenticate_user!
before_action :currencies, only: [:show]
def index
@exchange = Exchange.new
@currency_exchanges = cur... |
class CarabinerosController < ApplicationController
before_action only: [:show, :edit, :update, :destroy]
# :set_carabinero
#
# GET /carabineros
# GET /carabineros.json
def index
@carabineros = Carabinero.all
end
# GET /carabineros/1
# GET /carabineros/1.json
def show
@carabinero = Carabin... |
require 'new_relic/agent/method_tracer'
module Devise
module Models
module Instrumentable
extend ActiveSupport::Concern
included do
include NewRelic::Agent::MethodTracer
extend NewRelic::Agent::MethodTracer
add_method_tracer :password_digest
add_met... |
class Product < ActiveRecord::Base
belongs_to :category
validates :price, presence: true
end
|
require 'integration_spec_helper'
describe 'AfiliadoRepository' do
before(:each) do
@plan = Plan.new(nombre: 'Neo',
costo: 1000,
cobertura_visitas: CoberturaVisita.new(0, 0),
cobertura_medicamentos: CoberturaMedicamentos.new(0),
... |
class UsersController < Devise::RegistrationsController
def create
build_resource(sign_up_params)
resource_saved = resource.save_with_payment
yield resource if block_given?
if resource_saved
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_flashing_for... |
class Dollar
include Mongoid::Document
field :date, type: Date
field :value, type: Float
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 rake db:seed (or created alongside the db with db:setup).
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: citie... |
require "rails_helper"
feature "Admin updates a school" do
scenario "successfully" do
school = create(:school)
visit edit_school_path(school)
fill_in "school_name", with: "New Name"
click_on I18n.t("schools.form.submit")
expect(page).to have_text(
I18n.t("flash.actions.update.notice", re... |
require 'calculator'
RSpec.describe Calculator do
let(:basket) { { '002': 3 } }
subject { described_class.new(promo_rules_json, dummy_products) }
describe '#total' do
before do
allow(subject).to receive(:get_discounted_price).and_return false
end
it 'returns correct total for basket' do
... |
require 'spec_helper'
require 'csv'
RSpec.describe Boxing::Kata do
it 'has a version number' do
expect(Boxing::Kata::VERSION).not_to be nil
end
describe '.create_family' do
let(:csv_file) { File.new('spec/fixtures/family_preferences.csv') }
let(:table) {CSV.parse(csv_file, headers: true)}
contex... |
class RenameWorkflowsToJobSteps < ActiveRecord::Migration
def self.up
rename_table :tasks, :task_types
rename_table :workflows, :tasks
end
def self.down
rename_table :task_types, :tasks
rename_table :tasks, :workflows
end
end
|
# spec/requests/questions_spec.rb
require 'rails_helper'
RSpec.describe 'Questions', type: :request do
let(:user) { create(:user) }
let(:admin) { create(:user, :admin) }
let(:scenarios) { create_list(:scenario, 2) }
let(:scenario_id) { scenarios.first.id }
let!(:questions) { create_list(:question, 10, scenar... |
FactoryGirl.define do
sequence :position do |n|
(n-1) % 6
end
factory :athlete_heat do
position
association :athlete, factory: :user
heat
end
end
|
class Customer < ApplicationRecord
has_many :orders
has_many :tickets, through: :orders
validate :email, presence:true, uniqueness:true
validate :name, :lastname, presence:true
end
|
class Exhibit < ActiveRecord::Base
belongs_to :exhibition
has_paper_trail
has_many :exhibit_people
validates :name, :year, :exhibition, presence: true
validates :year, numericality: {less_than_or_equal_to: Date.today.year}
def human()
"Экспонат: #{self.name}"
end
def Exhibit.models_human_name()
"Э... |
module API
Devices = Syro.new(Deck) do
post do
workflow = Hacefrio::Workflows::DeviceRegistration.new
workflow.call(json: req.body.read) do |match|
match.success do |payload|
res.json(JSON.dump(payload))
end
match.failure do |error|
api_error(422, {device:... |
# frozen_string_literal: true
RSpec.describe BattingAverage, '#players' do
context 'whithout filters' do
subject(:batting_average) { described_class.new(batting_path: 'spec/fixtures/Batting.csv') }
it 'extract players data' do
expect(batting_average.players).to eq [
{ ab: 4, h: 0, player_id: '... |
# class ReservationValidator < ActiveRecord::Validator
# def validate(record)
# end
# end
class Listing < ApplicationRecord
validates :available_beds,
presence: true,
:numericality => { only_integer: true, :greater_than => 0 }
validates :price,
presence: true,
:numerical... |
module QBIntegration
class Bill < Base
def initialize(message = {}, config)
super
@payload = payload
end
def create
bill, po = bill_service.create
code = 200
summary = "Created Bill: #{bill[:doc_number]} with Purchase Order: #{po[:doc_number]}"
[ code, summary, bill,... |
require 'rake'
describe "rollout:list" do
before do
@rake = Rake::Application.new
Rake.application = @rake
Rake.application.rake_require "ar_rollout_tasks", [File.expand_path("../../../../lib/tasks", __FILE__)]
Rake::Task.define_task(:environment)
end
it "lists the features" do
ArRollout.stu... |
# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper.rb"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
EN... |
module PartyGoer
def drink
@drink_count += 1
@drink_count < 3
end
def sing
"Oops I did it again"
end
def cause_havoc
raise PersonalizedHavocError, "You should define this yourself!"
end
end
class PersonalizedHavocError < StandardError; end
|
module SonyCameraRemoteAPI
# Module providing utility methods
module Utils
module_function
# Get file name in the format of <prefix>_<num>.<ext>
# If there are files that matches this format, get the next number of it.
# @param [String] prefix
# @param [String] ext
# @param [Fixnum] start
... |
FactoryGirl.define do
factory :capture_form do
name {Faker::Name.name}
end
end
|
class ScheduledCruisesController < ApplicationController
before_action :authenticate_user!
def index
@scheduled_cruises = ScheduledCruise.all
end
def new
@scheduled_cruise = ScheduledCruise.new
end
def create
@scheduled_cruise = ScheduledCruise.new (scheduled_cruise_params)
i... |
#!/usr/bin/env ruby
# encoding: utf-8
# Japanese: [Brandon Pittman](http://www.brandonpittman.net/)
### CONFIG [ THESE VALUES OVERRIDE weatherparser.rb ]
# "City, State" or "City, Country" or ZIP Code
$mycity = 'Osaka, Japan'
# f for fahrenheit, c for celsius
$f_or_c = 'c'
# folder where the weather icons are located,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.