text stringlengths 10 2.61M |
|---|
RSpec.describe NgBanks do
it "has a version number" do
expect(NgBanks::VERSION).not_to be nil
end
it "return an array of banks" do
banks = NgBanks.getBanks()
allBanks = BANKS
expect(banks).to eq(allBanks)
end
it "return a single bank detail" do
bank = NgBanks.getBank_by(:code, "044")
... |
require 'rails_helper'
RSpec.describe "featured_researchers/index", type: :view do
before(:each) do
assign(:featured_researchers, [
FeaturedResearcher.create!(
:name => "Name",
:title => "Title",
:bio => "MyText",
:testimonial => "MyText",
:binary => "Binary"
)... |
require_relative 'base_page.rb'
class SolutionsPage < BasePage
set_url '/solutions/'
element :solutions_header, '.hero-solutions'
elements :solutions, '.solutions > li'
def initialize(driver)
super
end
def open
load
loaded?('Technology Solutions')
end
end
|
# A Few Things to Try...
# 7.5-Exercise page 57
# 99 Bottles of Beer on the Wall
# Write a program that prints out the lyrics.
# How I did it
num_start = 99
num_update = num_start
while num_update > 2
puts num_update.to_s + ' bottles of beer ont he wall, '
num_update.to_s + 'bottles of beer!'
num_update... |
#
# Blog settings
# Time.zone = "UTC"
activate :blog do |blog|
# This will add a prefix to all links, template references and source paths
# blog.prefix = "blog"
# blog.permalink = "{year}/{month}/{day}/{title}.html"
# Matcher for blog source files
# blog.sources = "{year}-{month}-{day}-{title}.html"
# bl... |
require('minitest/autorun')
require('minitest/rg')
require_relative("../river.rb")
require_relative("../fish.rb")
require_relative("../bear.rb")
class RiverTest < MiniTest::Test
def setup()
@bear = Bear.new("Hamish", [])
fish = Fish.new("Salmon")
@river = River.new("Clyde", [])
@fi... |
require 'test_helper'
class LogPublishingTest < ActionController::TestCase
tests DataFilesController
fixtures :all
include AuthenticatedTestHelper
def setup
login_as(:datafile_owner)
@gatekeeper=Factory(:gatekeeper)
end
test 'log when creating the public item' do
@controller = SopsControll... |
require 'spec_helper'
describe Game do
subject(:game) { Game.new }
describe "#new" do
it "works" do
expect(game).to be_an_instance_of Game
end
end
describe "#board" do
it "returns the board" do
expect(game.board).to be_an_instance_of Board
end
end
describe "#players" do
i... |
require 'test_helper'
class AlbumsControllerTest < ActionController::TestCase
setup do
@album = albums(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:albums)
assert_select 'title', 'Music Library'
assert_select 'h2', 'Albums'
assert_t... |
require 'json'
require 'csv'
# Data is just from 6, 7, 8 graders
# Education
# travel time to school
# hours of homework
# sleep hours school night
# sleep hours non-school night
csv_data = File.read('50-student-sample.csv')
csv = CSV.parse(csv_data, :headers=> true)
student_data = {}
csv.each_with_index do |row,... |
class List < ActiveRecord::Base
belongs_to :employee
has_many :tasks
has_many :incomplete_tasks, ->{where(completed_at: nil)}, class_name: "Task"
accepts_nested_attributes_for :tasks, reject_if: :all_blank, allow_destroy: true
end
|
module Rmega
module Net
include Loggable
include Options
def survive(retries = options.max_retries, &block)
yield
rescue ServerError
raise
rescue Exception => error
retries -= 1
raise(error) if retries < 0
logger.debug("[#{error.class}] #{error.message}. #{retries} a... |
class AddDefaultToActivities < ActiveRecord::Migration
def change
change_column :destinations, :activities, :string, :default => "lodging"
end
end
|
class AddUserIdToUserRoles < ActiveRecord::Migration
def self.up
add_column :user_roles, :user_id, :integer
end
def self.down
remove_column :user_roles, :user_id
end
end
|
require 'rails_helper'
describe '4.顧客登録情報変更〜退会のテスト' do
let!(:customer) { create(:customer) }
before do
visit new_customer_session_path
fill_in 'customer[email]', with: customer.email
fill_in 'customer[password]', with: customer.password
click_button 'ログイン'
end
describe '登録情報変更〜配送先一覧画面のテスト' do... |
class AddOrderColumnToBug < ActiveRecord::Migration[5.2]
def change
add_column :bugs, :order, :integer
add_index :bugs, :order
end
end
|
class MessageSerializer
include FastJsonapi::ObjectSerializer
attributes :greeting
end
|
pg_dba = input('pg_dba')
pg_dba_password = input('pg_dba_password')
pg_db = input('pg_db')
pg_host = input('pg_host')
control "V-73003" do
title "PostgreSQL must implement cryptographic mechanisms to prevent
unauthorized modification of organization-defined information at rest (to
include, at a minimum, PII ... |
FactoryGirl.define do
factory :goal do
objective { Faker::Lorem.sentence }
end
end
|
require 'moneyable'
class OrderLineItem < ActiveRecord::Base
attr_accessible :date, :product_id, :order_id, :price, :quantity, :subtotal, :created_by, :updated_by
belongs_to :order
belongs_to :product
include Moneyable
def to_s
"#{product.name}: #{quantity} x $#{cents_to_dollars(price)} = $#{cents_to_dollars(... |
class ModelsController < ApplicationController
def index
@models = Model.all
respond_to do |format|
format.html #index.html.erb
format.json { render json: @models }
end
end
def edit
@model = Model.find(params[:id])
end
def new
@model = Model.new
respond_to do |forma... |
class CompleteBooleanToOperation < ActiveRecord::Migration
def self.up
add_column :operations, :complete, :boolean
add_index :operations, :complete
end
def self.down
remove_index :operations, :complete
remove_column :operations, :complete
end
end |
require 'percentage_discount_promotion'
describe PercentageDiscountPromotion do
describe '#calculate_discount' do
subject { described_class.new.calculate_discount(double, subtotal) }
context 'subtotal below threshold' do
let(:subtotal) { 50 }
it { expect(subject).to eq 0 }
end
context '... |
# encoding: utf-8
require "rb.rotate/storage/entry"
require "rb.rotate/file"
require "rb.rotate/configuration"
module RbRotate
##
# Represents storage for archived files.
#
class Storage
##
# Directory for which storage is aimed.
#
@directory
att... |
require 'rails_helper'
RSpec.feature "UserRegistrations", type: :feature do
feature "New user sign up" do
scenario "with all valid credentials" do
sign_up 'FirstName', 'Last_Name', 'valid@email.com', 'SomePassword'
expect(page).to have_content("Welcome! You have signed up successfully.")
end
scena... |
#
# Cookbook Name:: loggly_rsyslog_ng
# Provider:: tls
#
# Author: Matt Veitas mveitas@gmail.com
# Author: Kostiantyn Lysenko gshaud@gmail.com
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
... |
# class EmailValidator < ActiveModel::EachValidator
# def validate_each(record, attribute, value)
# unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
# record.errors[attribute] << (options[:message] || "is not an email")
# end
# end
# end
class User < ActiveRecord::Base
# TODO implement... |
class OrdersController < ApplicationController
before_action :find_order, only: [:edit, :update]
skip_before_action :require_login
def show
id = params[:id]
if id == "cart" && session[:order_id] == nil
@orderitems = []
elsif id == "cart" || session[:order_id] == id.to_i
@order = Order.fin... |
require 'test_helper'
class PlaylistTest < ActiveSupport::TestCase
test "should create playlist" do
assert_difference('Playlist.count', 1, "Didn't create playlist") do
p = users(:alice).playlists.create(:name => "Something")
assert_equal users(:alice).id, p.user_id, "Didn't assign the playlist to the... |
# frozen_string_literal: true
require 'colorize'
module Senrigan
class Formatter
def initialize
end
def format(entity)
case entity
when Entities::Message
format_message(entity)
when Entities::MessageChangeEvent
format_message_change_event(entity)
else
ent... |
# == Schema Information
#
# Table name: sections
#
# id :bigint not null, primary key
# name :string not null
# project_id :integer not null
# order :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class S... |
# TODO: replace Regulatable module with Regulator class
class Regulator
attr_reader :readings
def initialize(readings)
if readings.respond_to?(:each)
@readings = readings
else
@readings = [readings]
end
end
def has_detected_violation?
readings.any? do |r|
# TODO: make it unnec... |
# frozen_string_literal: true
require "date_range_rollout/version"
require "date_range_rollout/rollout"
module DateRangeRollout
class Error < StandardError; end
class DateRangeError < Error; end
def self.build(start_duration, start_date, end_duration, end_date)
Rollout.new(start_duration, start_date, end_d... |
# encoding: utf-8
require 'rubygems'
require 'bundler'
begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end
require 'rake'
require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem ... |
require 'spec_helper'
describe HotReloadProxy::Config do
after(:each) { described_class.reset! }
it 'has default host' do
expect(described_class::DEFAULT_HOST).to eq('localhost')
end
it 'has default port' do
expect(described_class::DEFAULT_PORT).to eq('3100')
end
it 'has #host accessor' do
h... |
class BaseResponse
attr_accessor :operation_error, :status_code
def initialize(operation_error: nil, status_code: nil)
@operation_error = operation_error
@status_code = status_code
end
def success?
@operation_error.nil?
end
end |
class CreatePerformers < ActiveRecord::Migration
def self.up
create_table :performers do |t|
t.string :first_name
t.string :last_name
t.string :origin
t.timestamps
end
[
['Ksenia','Zhuleva','Russia'],
['Wenting', 'Kang', 'China'],
['Hyobi', 'Sim', 'South Korea'],
... |
class Api::V1::ProfileController < ApplicationController
def index
options = {
include: [:tickets]
}
render json: UserSerializer.new(current_user, options).serialized_json, status: :accepted
end
end
|
class AddHideShowToOptions < ActiveRecord::Migration
def change
add_column :options, :is_hidden, :bool
add_column :options, :show_condition, :string
end
end
|
# Be sure to restart your server when you modify this file.
# This file contains settings for the application
UbPub::Application.configure do
# https://github.com/davidjbradshaw/iframe-resizer
config.iframe_resizer_path = '//' +
Rails.application.secrets.iframe_resizer_host +
'/web-apps/assets/javascripts/... |
# frozen_string_literal: true
module Tikkie
module Api
module Resources
# Error object in non-successful responses.
class Error
attr_reader :data
def initialize(data)
@data = data
end
def code
data[:code]
end
def message
... |
class CompaniesController < ApplicationController
before_action :set_company, only: [:show, :update, :destroy]
# GET companies
def index
@companies = Company.all
json_response(@companies)
end
# POST company
def create
@company = Company.create!(company_params)
json_response(@company, :crea... |
class LoginPage
include Capybara::DSL
def Login(usuario,senha,coop)
within_window -> { page.title == 'Colmeia'} do
find("input[id=CHAVE]").set usuario
find("input[id=UNIDADETextBox]").set coop
find("input[id=CHAVE_ENCRIPT]").set senha
click_button "Enviar"
within_window -> { page.title =... |
RSpec.describe "User Enrollment", "#request" do
context "GET Users" do
it "gets user record", :smoke => true, :getUser => true do |example|
response = RestClient.get "#{$url}" + '?id=1'
expect(response.code).to eq 200
# binding.pry
parsed_json = ActiveSupport::JSON.decode(response.body)
puts "Retriev... |
# == Schema Information
#
# Table name: settings
#
# id :integer not null, primary key
# type :string(255) not null
# value :string(255)
# created_at :datetime
# updated_at :datetime
#
require 'rails_helper'
RSpec.describe Settings, :type => :model do
describe Settings::Defaul... |
FactoryBot.define do
factory :course do
year "k1"
factory :course_with_modules do
transient do
modules_count 4
end
after(:create) do |course, evaluator|
create_list(
:course_module,
evaluator.modules_count,
course: course,
)
e... |
class CreatePhotos < ActiveRecord::Migration
def change
create_table :photos do |t|
t.string :image, null: false, default: ""
t.string :text, null: false, default: ""
t.boolean :is_avatar, default: false
t.boolean :is_bg, default: false
t.... |
# frozen_string_literal: true
# Copyright (c) 2019 Danil Pismenny <danil@brandymint.ru>
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require_relative 'config/application'
Rails.application.load_tasks
if... |
POWERS_OF_TWO = [6, 2, 4, 8]
POWERS_OF_THREE = [1, 3, 9, 7]
POWERS_OF_FOUR = [4, 6]
POWERS_OF_SEVEN = [1, 7, 9, 3]
POWERS_OF_EIGHT = [8, 4, 2, 6]
POWERS_OF_NINE = [1, 9]
def last_digit(num_string, pow_string)
last_digit = num_string[-1].to_i
power = (pow_string[-2..-1] || pow_string).to_i
return 1 if l... |
class CreateJobApplications < ActiveRecord::Migration
def change
create_table :job_applications do |t|
t.date :date
t.references :user, index: true, foreign_key: true
t.references :job, index: true, foreign_key: true
t.string :status, default: "рассматривается"
t.timestamps null: fa... |
# 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... |
require 'spec_helper'
feature 'workshop coach' do
before { login_as_user }
scenario 'see workshop coach text' do
visit_profile_page_of_a_workshop_coach
see_workshop_coach_text
visit_profile_of_normal_person
not_see_workshop_coach_text
end
def login_as_user
person = create(:person)
vis... |
class AddDay1Event2ToWeddings < ActiveRecord::Migration
def change
add_column :weddings, :day1_event2, :string
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :set_token
before_filter :set_locale
def set_token
@token = form_authenticity_token
end
def set_locale
I18n.locale = extract_locale_from_accept_language_header
end
private
def extract_locale_from_accept_la... |
require 'rails_helper'
RSpec.describe UsersController, type: :controller do
describe 'GET #new' do
it "renders the new user's page" do
get :new, params: {}
expect(response).to render_template('new')
expect(response).to have_http_status(200)
end
end
end
|
class DatabaseInstanceRelationship < ActiveRecord::Base
acts_as_authorizable
acts_as_audited
named_scope :def_scope
belongs_to :from, :class_name => "DatabaseInstance", :foreign_key => "from_id"
belongs_to :to, :class_name => "DatabaseInstance", :foreign_key => "to_id"
validates_presence_of :name... |
require_relative 'test_helper'
require_relative '../motifs'
describe Motifs do
describe Motifs::SIGLE do
it_ "matche un sigle correct" do
"INF1130".must_match Motifs::SIGLE
end
it_ "ne matche pas un sigle trop court" do
"INF130".wont_match Motifs::SIGLE
end
it_ "ne matche pas un sig... |
# frozen_string_literal: true
module Kafka
class PendingMessage
attr_reader :value, :key, :headers, :topic, :partition, :partition_key, :create_time, :bytesize
def initialize(value:, key:, headers: {}, topic:, partition:, partition_key:, create_time:)
@value = value
@key = key
@headers = h... |
# frozen_string_literal: true
FactoryBot.define do
factory :order_detail do
quantity { 1 }
created_by { 0 }
trait :completed do
state { "complete" }
end
trait :canceled do
state { "canceled" }
end
trait :canceled_with_cost do
state { "complete" }
canceled_at { 3... |
ActiveAdmin.register_page "Dashboard" do
menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
content title: proc{ I18n.t("active_admin.dashboard") } do
div class: "blank_slate_container", id: "dashboard_default_message" do
end
# Here is an example of a simple dashboard with colum... |
Given /^I import the video "([^"]*)"$/ do |file|
@file_name = file
visit "/"
click_button "Import"
attach_file "video_source", path_to_fixture(file)
click_button "OK"
end
Then /^I should see it in the videos list panel$/ do
page.should have_content @file_name
end
|
require 'set'
class WordChainer
def initialize(filename)
@dictionary = File.readlines(filename).map(&:chomp).to_set
@path = []
end
def run(source, target)
@current_words = [source]
@all_seen_words = { source => nil }
until @current_words.empty?
explore_current_words
end
build... |
require 'rails_helper'
RSpec.describe SheetSync::Download::TweetReviewRowParser do
describe '#parse' do
let(:row) do
double('SheetRow', artist: 'The Babies',
album: 'Our House On The Hill',
genre: 'Indie Rock',
rating: '3-',
... |
require 'rails_helper'
RSpec.describe Player, type: :model do
shared_examples_for 'average age by position' do |klass|
subject { klass.average_age_for_position 'C' }
context 'when no players' do
it { is_expected.to be_nil }
end
context 'when no players with that position' do
it { is_exp... |
require 'rails_helper'
describe BusinessQuery do
it 'raises an error when receiving unexpected params' do
expect { BusinessQuery.new({ test: "Test" }) }.to raise_error(RuntimeError)
end
it 'searches the database for the correct object' do
business = FactoryGirl.create(:business)
query = BusinessQuer... |
module Sunsap
VERSION = '0.2.0'
attr_accessor :reportername, :messages
# The reporter
class Reporter
# Create a new reporter
#
# @api public
# @param [reportername] the name of the reporter as a string
#
# @example Make a new reporter
#
# reporter = Sunsap::Reporter.new("tes... |
# This migration comes from mjbook (originally 20150518103300)
class CreateMjbookJournals < ActiveRecord::Migration
def change
create_table :mjbook_journals do |t|
t.integer :company_id
t.integer :paymentitem_id
t.integer :expenditem_id
t.decimal :adjustment, :precision => 8, :scale => 2, ... |
require 'ostruct'
icecream = OpenStruct.new
icecream.flavor = "strawberry"
puts "The flavor: #{icecream.flavor}"
# OpenStruct 类来自于Ruby标准库,它看起来有点神奇。一个OpenStruct对象的属性用起来就像是Ruby的变量。
# 如果想要一个新属性,那么只需要给它赋个值就行了,然后它就奇迹般的存在了
# 其中就用到了method_missing 的原理
|
class Post < ActiveRecord::Base
validates :he_said, presence: true
validates :she_said, presence: true
validates :he_name, presence: true
validates :she_name, presence: true
validates :he_summary, presence: true
validates :she_summary, presence: true
validates :he_votes, numericality: {greater_than_or_equ... |
require File.dirname(__FILE__) + '/../../../test_helper'
class TinyCI::Scheduler::RunnerTest < ActiveSupport::TestCase
def setup
TinyCI::Scheduler::Runner.any_instance.stubs(:trap)
end
test "should run" do
TinyCI::Scheduler::Runner.instance.expects(:run)
TinyCI::Scheduler::Runner.run
end
te... |
Rails.application.routes.draw do
root to: "home#show"
resources :categories, only: :show
get :month, to: "months#show"
end
|
require 'spec_helper'
describe Ohm::Set do
class Item < Ohm::Model
attribute :name
attribute :email
attribute :priority
index :name
index :priority
unique :email
track :notes
end
describe '#pop' do
subject { Item.all.pop(options) }
describe 'with sort options' do
bef... |
class Queue
attr_accessor :queue_var
def initialize
@queue_var = []
end
def enqueue(el)
self.queue_var << el
end
def dequeue
self.queue_var.unshift
end
def peek
self.first
end
end |
# frozen_string_literal: true
FactoryBot.define do
factory :course_topic do
association :course
sequence(:text) { |n| "Topic #{n}" }
end
end
|
# frozen_string_literal: true
class CommentsController < ApplicationController
before_action :ensure_correct_user, only: [:destroy]
def create
@comment = Comment.new(
content: params[:content],
user_id: @current_user.id,
post_id: params[:post_id]
)
if @comment.save
flash[:succe... |
module Mutations
class CreateQuestion < Mutations::BaseMutation
argument :title, String, required: true
argument :body, String, required: true
argument :render, String, required: true
type Types::QuestionType
def resolve(title: nil, body: nil, render: nil)
if $sessionManag... |
json.array!(@users) do |user|
json.extract! user, :id, :email, :hashed_password, :name, :blog_id, :image
json.url user_url(user, format: :json)
end
|
require 'spec_helper'
describe Stormpath::Oauth::AccessTokenAuthenticationResult, :vcr do
let(:account_data) { build_account(email: email, password: password) }
let(:email) { random_email }
let(:password) { 'P@$$w0rd' }
let(:account) { test_application.accounts.create(account_data) }
let(:password_grant_... |
require 'spec_helper'
module TestModule
extend BetfairApiNgRails::Api::RequestMethods
end
describe "listTimeRanges request method" do
it_behaves_like 'simple list filtering request', 'listTimeRanges' do
let(:method_name) { "list_time_ranges" }
let(:result_class) { BetfairApiNgRails::TimeRangeResult }
... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe TransactionsController, type: :controller do
let(:user) { create(:user) }
before(:each) do
sign_in user
end
describe 'GET #index' do
let(:transaction_one_day_ago) { create(:transaction, :one_day_ago, user: user) }
let(:transacti... |
ActiveAdmin.register Payment do
permit_params :order_id, :authNumber, :cardToken, :cardMask, :cardExp, :txId, :uniqueID
config.filters = false
config.clear_action_items!
before_filter :only => :index do @skip_sidebar = true end
index do
id_column
column :user
column :order
column :authNumb... |
class CreateCustomers < ActiveRecord::Migration
def up
execute %{
CREATE TABLE customers (
customer_id bigint NOT NULL,
account_id bigint REFERENCES accounts NOT NULL,
type text NOT NULL,
created_at audit_timestamp,
updated_at audit_timestamp,
CONSTRAINT uniqu... |
class Api::CardsController < ApplicationController
load_and_authorize_resource
respond_to :json
def index
respond_with @cards
end
def show
respond_with @card
end
def create
if @card.save
render json: @card, status: 201, location: [:api, @card]
else
render json: { errors: @ca... |
require_relative '../automated_init'
context "Run" do
context "Finish" do
context "Run Passed" do
run = Run.new
run.finish
context "Output" do
result = true
test "Finish run" do
recorded = run.output.recorded_once?(:finish_run) do |r|
r == result
... |
class AddWorkoutGroupIdToUserPreviousWorkout < ActiveRecord::Migration[5.1]
def change
add_column :user_previous_workouts, :workout_group_id, :integer
remove_column :user_previous_workouts, :workout_id
end
end
|
class Api::AssignmentsController < ApplicationController
def index
assignments = Assignment.all
render json: assignments, status: 200
end
def create
assignment = Assignment.new(assignment_params)
if assignment.save
render json: assignment, status: 201
else
render json: assignment... |
class PagesController < ApplicationController
def create
pages = Page.all.where(site_id: params[:site_id])
if pages.empty?
position = 1
else
position = pages.order("position DESC").first.position + 1
end
respond_with Page.create(page_params.merge(position: position))
end
def show
respond_with Pa... |
module CybersourceryTesting
class Vcr
def self.configure
VCR.configure do |c|
c.cassette_library_dir = ENV['CYBERSOURCERY_VCR_CASSETTE_DIR']
c.hook_into :webmock
c.allow_http_connections_when_no_cassette = true
c.register_request_matcher :card_number_equality do |request_1, r... |
# frozen_string_literal: true
RSpec.describe Api::V1::ContactUsEmail::CreateSchema do
describe 'attributes' do
def schema(**options)
described_class.call(options.reverse_merge(
name: FFaker::Name.name,
email: FFaker::Internet.email,
... |
# frozen_string_literal: true
require 'statistic_calcs/hypothesis_test/base'
require 'statistic_calcs/helpers/required_validations'
module StatisticCalcs
module HypothesisTest
# Test a mean for known sigma
class Mean < Base
include StatisticCalcs::Helpers::RequiredValidations
attr_accessor :sam... |
require 'states/close_state'
require 'states/lock_state'
require 'states/open_state'
require 'transitions/door_transitions.rb'
class Context
attr_accessor :state
def initialize
@state = OpenState.new
transitions = [
:close_door,
:lock_door,
:unlock_door,
:open_door
]
from... |
class RenderingContext < Struct.new(:view, :content_name, :document, :level)
def render_document
send "render_#{document.class.name.downcase}"
end
def render_string
view.paragraph(content_name, level) do
view.string(document, level, content_name)
end
end
def render_link
view.paragrap... |
Pod::Spec.new do |s|
s.name = 'M5KeyPath'
s.version = '1.0.1'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'Objective-C macro for compile/refactor-safe key path declaration.'
s.homepage = 'https://github.com/mhuusko5/M5KeyPath'
s.social_media_url = 'https://twitter.com/mhuusko5'
s.author... |
class AddUserstoriesColumnToChecks < ActiveRecord::Migration
def change
add_column :checks, :user_story_id, :integer
end
end
|
require "../factory/*"
module ListFactory
class ListLink
include Link
def list_link(caption:, url:)
super(caption: caption, url: url)
end
def make_html
"<li><a href=\"#{url}\">#{caption}</a></li>\n"
end
end
end
|
class CreateStatusChangeResistances < ActiveRecord::Migration[5.1]
def change
create_table :status_change_resistances do |t|
t.integer :stun
t.integer :poison
t.integer :silence
t.integer :bleeding
t.integer :sleep
t.integer :stone_curse
t.integer :freeze
t.integer ... |
require 'net/scp'
module Backup
module Record
class SCP < Backup::Record::Base
attr_accessor :ip, :user, :password
def load_specific_settings(adapter)
%w(ip user password path).each do |method|
send(:"#{method}=", adapter.procedure.get_storage_configuration.attributes[method... |
class ProdtypesController < ApplicationController
# GET /prodtypes
# GET /prodtypes.json
def index
@prodtype = Prodtype.new
@prodtypes = Prodtype.all
end
# GET /prodtypes/new
def new
end
# POST /prodtypes
# POST /prodtypes.json
def create
@prodtype = Prodtype.new(prodtype_params)
... |
require "spec_helper"
describe MedicsController do
describe "routing" do
it "routes to #index" do
get("/medics").should route_to("medics#index")
end
it "routes to #new" do
get("/medics/new").should route_to("medics#new")
end
it "routes to #show" do
get("/medics/1").should rou... |
require("minitest/autorun")
require('minitest/reporters')
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new
require_relative("../room")
require_relative("../guest")
require_relative("../song")
class SongTest < MiniTest::Test
def setup
@song1 = Song.new("The Rolling Stones - Paint It Black")
@song2 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.