text stringlengths 10 2.61M |
|---|
module Jekyll
module StripFigCaptionFilter
def strip_figcaption(input)
input.gsub(/<figcaption.*?<\/figcaption>/m, "")
end
end
end
Liquid::Template.register_filter(Jekyll::StripFigCaptionFilter)
|
class ChangeAuditIdsToUuids < ActiveRecord::Migration[5.0]
def change
remove_column :audits, :auditable_id, :integer
add_column :audits, :auditable_id, :uuid
remove_column :audits, :associated_id, :integer
add_column :audits, :associated_id, :uuid
add_index :audits, [:auditable_id, :auditable_ty... |
require_relative 'bowling'
class Menu
def initialize
@bowling = Bowling.new
end
def welcome
puts ''
puts 'BOWLING SCORECARD'
puts '----------'
puts 'Welcome, happy bowling!'
puts ''
end
def interactive_menu
loop do
print_menu
puts ''
puts 'Please enter a numbe... |
require_relative 'bike'
class DockingStation
DEFAULT_CAPACITY = 20
attr_reader :bikes
attr_accessor :capacity
def initialize(capacity = DEFAULT_CAPACITY)
@bikes = []
@capacity = capacity
end
def release_bike
raise RuntimeError, "There are no bikes" if empty?
working_bikes = []
@bike... |
#!/usr/bin/env ruby
require 'cocoapods'
require 'jazzy'
require 'fileutils'
require 'mustache'
require 'optparse'
require 'pathname'
require 'tempfile'
require 'yaml'
# Redefine backtick to exit the script on failure.
# This is basically `set -e`, but Ruby.
define_method :'`' do |*args|
puts "> #{args}"
output = ... |
class AddFastSessions < ActiveRecord::Migration
CGI::Session::ActiveRecordStore::FastSessions.table_name = "app_session_store"
# If you're going to use this module with MySQL 5.1.22+, then you'd
# like to set this to +true+ because it will provide you with consecutive
# data inserts in InnoDB. Another cases w... |
#!/usr/bin/env ruby
require 'optparse'
required_options = {
input: nil,
output: nil,
output_format: "pdf"
}
OptionParser.new do |parser|
parser.on("-i", "--input PATH", "A path to the input file.") do |v|
required_options[:input] = v
end
parser.on("-o", "--output PATH", "A path to the output file.")... |
class Favorite < ApplicationRecord
belongs_to :user, foreign_key: :user_id
belongs_to :micropost, foreign_key: :content_id
end
|
require_relative '../test_helper'
class RolesControllerTest < ActionController::TestCase
def setup
sign_in(writers(:eloy))
end
test 'shows a list of roles' do
get :index
assert_response :ok
assert_template 'roles/index'
end
test 'shows a new role page' do
get :new
assert_response :o... |
#
# Reference stock in multiple storages
#
# ====================================
#
# 2 rental storages
#
# Rental Storage S1
# Rental Location L1
# Pickup Place L1PP1
# Pickup Place L1PP2
#
# Rental Storage S2
# Rental Location L2
# Pickup Place L2PP1
#
# ------------------------
#
# 5 re... |
# General site settings are contained within this file. They are all
# edited from source (no singletons and shit)
module SiteConfig
IP_SALT = "i36ys3rbcii2asrg6t7tydtd15hq9wkc"
PW_SALT = "gk63bbj56l8h0kf6nvvekl9e5opul7c1"
def self.ip_salt
return IP_SALT
end
def self.pw_salt
return PW_SALT
en... |
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "userq/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "userq"
s.version = UserQ::VERSION
s.authors = ["Bilawal Hameed"]
s.email = ["bilawal@studenthack.co... |
# frozen_string_literal: true
module Jaguar
VERSION = "0.0.0"
end
|
class Api::ExercisesController < ApplicationController
def index
exercises=Exercise.all
render json: exercises, status: :ok
end
def show
render json: Exercise.find(params[:id]), status: :ok
end
def create
exercise = Exercise.new(exercise_params)
... |
require 'test_helper'
class ContainerTest < Minitest::Test
include TestSupport::Hooks
include TestSupport::Data
def docker_id
'814007b2fdcfd6817edc6da30e602dbc103ec87cfc337187122ce198e15af656'
end
def setup
configure_defaults
end
def container
@container ||= VCR.use_cassette(:introspection... |
require 'rails_helper'
describe Linter::Unsupported do
describe '.can_lint?' do
it 'returns true' do
result = Linter::Unsupported.can_lint?(double)
expect(result).to eq true
end
end
describe '#file_review' do
it 'raises' do
linter = Linter::Unsupported.new(
hound_config: d... |
class ModelValidation
def required_class_methods
[
:create_from_string
]
end
def required_instance_methods
[
:row_count,
:column_count,
:alive?,
:set_living_state,
:set_living_states,
:next_generation_model,
:number_living
]
end
... |
class CreateBusinesses < ActiveRecord::Migration
def change
create_table :businesses do |t|
t.string :name
t.string :logo
t.string :description
t.string :video_link
t.string :instruction
t.datetime :opened_at
t.integer :min_investitions
t.string :status
t.tim... |
class Library
attr_reader :books,
:authors
def initialize
@books = []
@authors = Hash.new {|hash,key| hash[key] = []}
end
def add_to_collection(book)
@books << book
@authors["#{book.author_first_name} #{book.author_last_name}"] << book
end
def include?(title)
@books.any? do |boo... |
class ShowManager
def initialize
end
def singleton
@instance ||= ShowManager.new
end
def find_or_create_show(name)
show = Show.find_from_string(name)
if ! show
show = load_show(name)
end
show
end
def load_show(name)
cdb = CentralTVDatabase.new
tvd_show = cdb.find_ser... |
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Robots::DorRepo::Accession::Shelve do
let(:druid) { 'druid:zz000zz0001' }
let(:robot) { described_class.new }
let(:process) do
instance_double(Dor::Workflow::Response::Process, lane_id: 'low')
end
before do
allow(Dor::Services::Clie... |
class Feadback < ApplicationRecord
has_attached_file :avatar, styles: { thumb: "130x130#" }, :default_url => "missing_:style.png"
validates_attachment_content_type :avatar, content_type: /\Aimage\/.*\z/
validates :name, :description, presence: true
attr_accessor :delete_avatar
before_validation { self.avat... |
class CreateDiningSpots < ActiveRecord::Migration
def change
create_table :dining_spots do |t|
t.string :name
t.string :address
t.string :website
t.integer :user_id
t.timestamps null: false
end
end
end
#stretch goals: dining_spot type #=> dive bar, cocktail, hi_dining, food_c... |
require 'spec_helper'
describe QML::ListModel do
let(:model) { QML::ListModel.allocate }
describe '#count' do
it 'fails with NotImplementedError by default' do
expect { model.count }.to raise_error(NotImplementedError)
end
end
describe '#[]' do
it 'fails with NotImplementedError by default'... |
# Copyright 2012 AMG.lab, a Bull Group Company
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
# frozen_string_literal: true
module Menu
module MenuHelper
include Rails.application.routes.url_helpers
include MainMenuHelper
include AdminMenuHelper
DEFAULTABLE_FIELDS = %i[show_when display].freeze
def show_link?(*roles, strict: false, **options)
req_cont, req_act, not_cont, not_act =... |
class StudentsController < ApplicationController
def index
if params[:section_id]
@section = Section.find(params[:section_id])
@students = @section.students.all
elsif params[:house_id]
@house = House.find(params[:house_id])
@students = @house.students.all
else
@students = Stu... |
class SittersController < ApplicationController
# GET /sitters
def index
@sitters = Sitter.all
end
# GET /sitters/1
def show
@sitter = Sitter.find(params[:id])
end
# GET /sitters/new
def new
@sitter = Sitter.new
@sitter.sit_pets.build
end
# GET /sitters/1/edit
def edit
@sitt... |
describe MangoPay::Configuration do
it 'fails when calling with wrong client credentials' do
expect {
c = MangoPay.configuration
c.client_id = 'test_asd'
c.client_passphrase = '00000'
MangoPay::User.fetch()
}.to raise_error(MangoPay::ResponseError)
end
it 'goes ok when calling wi... |
# Encoding: UTF-8
Gem::Specification.new do |s|
s.name = %q{backstage-core}
s.version = '0.0.1'
s.require_paths = %w(lib)
end |
class ChangeLatitudeToBeFloatInPois < ActiveRecord::Migration[5.2]
def change
change_column :pois, :latitude, :float, using: 'latitude::float'
end
end
|
class GroupScenario < ActiveRecord::Base
belongs_to :group
belongs_to :scenario
validates_presence_of :group, :scenario
validates_uniqueness_of :scenario_id, :scope => :group_id
after_create :create_memberships
private
def create_memberships
group.members.each { |member| group.memberships.... |
require 'active_support/core_ext/class/attribute_accessors'
require 'active_support/core_ext/class/attribute'
module DemoData
class ModelCollection
class_attribute :api_path_name
def initialize( options=self.record_options )
@data = fetch( self.api_path_name, options )
end
... |
# gets.chomp retorna apenas o input que saiu do teclado
# .to_i converte float em int
# puts printa o valor na tela
print "Please enter the number you would like to FizzBuzz up to: "
maximum_number = gets.chomp.to_i
# Cria um loop começando por 1 até o número digitado
1.upto(maximum_number) do |current_number|
# S... |
class ApiController < ActionController::API
include ::ActionController::Cookies
def authorize_request
return if Rails.env.development?
jwt = cookies.signed[:jwt]
begin
@decoded = JsonWebToken.decode(jwt)
@current_user = User.find(@decoded[:user_id])
rescue
render json: { errors: "... |
class Container < ActiveRecord::Base
attr_accessible :label, :position, :parent_container_id, :container_kind_id
belongs_to :container_kind
belongs_to :parent_container, :class_name => "Container", :foreign_key => "parent_container_id"
has_many :containers, :foreign_key => "parent_container_id"
#questa cost... |
class Language < ApplicationRecord
has_many :courses
has_many :new
has_many :faq_categories
has_many :template_modules
end
|
class Users::SessionsController < Devise::SessionsController
# before_filter :configure_sign_in_params, only: [:create]
# GET /resource/sign_in
# def new
# super
# end
# DELETE /resource/sign_out
# def destroy
# super
# end
# protected
# If you have extra params to permit, append them to t... |
class User < ActiveRecord::Base
attr_accessible :email, :name, :orgname, :usertype
has_many :visuals
validates :email, :presence => true
validates :name, :presence => true
validates :usertype, :presence => true
end
|
class CwadCoverSheet < AccessBrowserV2
include Singleton
def initialize
super
add_verify(CucumberLabel.new("cwad details"), VerifyContainsText.new, AccessHtmlElement.new(:id, 'cwad-details'))
end
end
Then(/^the cwad details view contains$/) do |table|
cwad =CwadCoverSheet.instance
table.rows.... |
class CceReportGenerator
unloadable
def initialize(params_hash)
@errors=[]
@params_hash=params_hash
@status=validate_generation(@params_hash)
@batches=get_batches_list(@params_hash) if @status
end
def validate_and_save
Delayed::Job.enqueue(self,{:queue => 'cce_report'})
end
def valida... |
require File.dirname( File.expand_path( __FILE__) ) + "/../../../shared_ruby/euler.rb"
class Fractran
attr_reader :states, :program, :two_indices
def initialize(seed_state = 2, program = [[17, 91], [78, 85], [19, 51],
[23, 38], [29, 33], [77, 29],
... |
require 'rails_helper'
describe Product do
it { should have_many(:reviews) }
it { should validate_presence_of :name }
it { should validate_presence_of :zip }
it { should validate_presence_of :cost }
it { should validate_presence_of :country_of_origin }
it { should validate_length_of(:name).is_at_most(100) ... |
require 'test/unit'
require File.dirname(__FILE__) + '/../conf/include'
require 'irc_client.rb'
require 'bot.rb'
IRC_LOG_FILE_PATH = IRC_LOG_DIR_PATH + '/test.log'
class TestBot < Bot
PING = "TestBot(PING)"
attr_accessor :heard
def initialize(name)
@pinged = false
super(name)
end
def pin... |
class UserMailer < ActionMailer::Base
add_template_helper(ApplicationHelper)
default :from => "me@nicolasgrenie.com"
def email_to_mom(email, payment)
@payment = payment
@order = payment.order.to_struct
@payer = payment.payers_name
@buyer = payment.buyers_name
begin
mail(:to => email, :s... |
module Vcloud
module Core
class Vm
extend ComputeMetadata
attr_reader :id
def initialize(id, vapp)
unless id =~ /^#{self.class.id_prefix}-[-0-9a-f]+$/
raise "#{self.class.id_prefix} id : #{id} is not in correct format"
end
@id = id
@vapp = vapp
e... |
$LOAD_PATH.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
require 'prime_number_calc'
require 'optparse'
require 'Formatador'
options = { }
optparse = OptionParser.new do |opts|
opts.on('-m', '--maximum MAXIMUM', 'Maximum prime numbers to calculate table against') do |value|
options[:maximum] = va... |
class RenameInOfficeSinceToHeldSinceInRepresentatives < ActiveRecord::Migration[5.0]
def change
rename_column :representatives, :in_office_since, :held_since
end
end
|
class AdminsController < ApplicationController
def index
@admins = Admin.all
end
def create
admin = Admin.create(admin_params)
if admin.valid?
render json: { status: 200, html: render_to_string(partial: "admins/row", locals: { admin: admin }, layout: false) }
else
render json: { statu... |
require 'spec_helper'
describe Trip do
let!(:user) { User.create(:username => "A", :email => "email@example.com", :password => "hungry") }
describe ".create_from_tripit" do
let(:mock_trip) { double(:tripit_trip, :display_name => "a trip", :primary_location => "somewhere", :start_date => Date.today, :end_date ... |
class WarrantiesController < ApplicationController
before_action :set_registration, only: [:show, :edit, :update, :destroy]
def terms
end
def warranty
@warranty = Registration.new
@month = ["JANUARI", "FEBRUARI", "MARET", "APRIL", "MEI", "JUNI", "JULI", "AGUSTUS", "SEPTEMBER", "OKTOBER", "NOV... |
WIN_COMBINATIONS = [
[0,1,2], #top
[3,4,5], #middle
[6,7,8], #bottom
[0,4,8], #left cross
[2,4,6], #right cross
[0,3,6], #left line
[2,5,8], #right line
[1,4,7] #center line
]
def display_board (board)
puts " #{board[0]} | #{board[1]} | #{board[2]} "
puts "-----------"
puts " #{board[3]} | #{boa... |
require 'spec_helper'
describe Kickstart::PasswdUtil do
context '#crypt_pw' do
before do
allow(Util).to receive(:generate_alnum_string) { "salt_string" }
end
it 'encrypts a given password with salt string' do
pwd = Kickstart::PasswdUtil.crypt_pw("test123!$&")
expect(pwd).to include("s... |
require_relative 'deck'
require_relative 'card'
require_relative 'user'
require_relative 'dealer'
require_relative 'gambler'
class Board
attr_reader :result
def initialize(params = {})
@user = User.new(params[:name])
@deck = Deck.new
@dealer = Dealer.new('dealer')
@bank = 0
end
def start
... |
namespace :parser do
desc "downloads site categories structure"
task structure: :environment do
Gatherer::CategoriesCollector.new.process.each do |category|
Category.create(category)
end
end
desc "downloads products"
task download: :environment do
urls = Category.pluck(:url)
products = ... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
vagrant_api = "2"
server_ip = "192.168.5.21"
server_memory = "2048" # MB
server_cpus = "2"
server_name = "unnamed" # CHANGE THIS
# Provisioning shell scripts
$base_script = <<SCRIPT
#!/usr/bin/env bash
echo ">>> Updating repositories"
sudo... |
require 'rails_helper'
RSpec.describe "graphic_requests/show", type: :view do
before(:each) do
@graphic_request = assign(:graphic_request, GraphicRequest.create!(
:user => nil,
:designer => "Designer",
:request => "MyText",
:data => "MyText",
:status => 2
))
end
it "renders... |
class Hash
def to_h
self
end unless method_defined?(:to_h)
end
|
# Example usage of JavaClass::Classpath and JavaClass::Classpath::TrackingClasspath:
# Use the classes of one module and mark all their dependencies. Then find all modules
# which were not referenced. This list contains *potential* unused libraries (modules).
# Note that the libraries may still be used by reflect... |
class Eorowdatcol < ActiveRecord::Base
validates :name, :presence => true, :uniqueness => true
belongs_to :eorow
belongs_to :eostoredat
end
|
require 'rake'
require 'rake/tasklib'
# Continuting the examples.
module RakeTaskExample
# RakeTaskExample::Example01
class Example01 < ::Rake::TaskLib
# Initialize the class.
def initialize
yield self if block_given?
example_task
end
# example_task
#
# The examp... |
class CreateUtDefects < ActiveRecord::Migration
def change
create_table :ut_defects do |t|
t.string :defect_id
t.string :position
t.string :length
t.string :depth
t.string :height
t.string :angle
t.string :db
t.string :type
t.integer :ultrasonic_id
t.ti... |
require 'spec_helper'
module EmailVerificationTokensControllerHelpers
def verifies_email_address
it "verifies the email address" do
expect { action }.to change { email_address.reload.verified }.to true
end
end
def does_not_verify_email_address
it "does not verify the email address" do
ex... |
class AllWord < ActiveRecord::Base
has_many :user_words
has_many :all_users, :through => :user_words
has_many :subtitle_words
has_many :all_subtitles, :through => :subtitle_words
end
|
require "tephue/interfaces/repository/query/true"
module Tephue
module Repository
module Query
# This condition always evaluates to true
class True < ::Tephue::Interfaces::Repository::Query::True
attr_reader :type
def initialize
@type = :true
end
def ==(oth... |
class Bakery
attr_accessor :name
@@all = []
def self.all
@@all
end
def initialize(name)
@name = name
@@all << self
end
def desserts
Dessert.all.select {|dessert| dessert.bakery == self}
end
def ingredients
self.desserts.map {|dessert| dessert.ingredients}.flatten
end
def c... |
class AddVilleAndStreetToChevals < ActiveRecord::Migration[5.0]
def change
add_column :chevals, :ville, :string
add_column :chevals, :rue, :string
end
end
|
class AddDrawingToComponent < ActiveRecord::Migration[6.0]
def change
add_column :refinery_caststone_components, :drawing, :binary, if_not_exists: true
add_column :refinery_caststone_components, :drawing_width, :integer, if_not_exists: true
add_column :refinery_caststone_components, :drawing_height, :inte... |
class Despesa < ActiveRecord::Base
validates_presence_of :valor, :message => "não pode ser vazio"
validates_presence_of :data, :message => "deve ser definida"
belongs_to :vendedor
has_and_belongs_to_many :tags
end
|
# frozen_string_literal: true
module Haikunate
VERSION = "0.1.1"
end
|
require 'sinatra/base'
require 'sinatra/flash'
require './lib/peeps'
require './lib/user'
class Chitter < Sinatra::Base
enable :sessions
register Sinatra::Flash
helpers do
def current_user
User.get_user_by_id(session[:current_user_id])
end
def redirect_if_no_current_user
redirect '/' un... |
class AddChildSchoolToProfiles < ActiveRecord::Migration[5.1]
def change
add_column :profiles, :child_school, :string
end
end
|
# Reprocess thumbnails for game_ids
# Takes an array of ids, because you don't want to hook the
# delayed job worker process for 20000+ reprocessing runs. It
# will take too long, and put off more important things.
#
# Open up console and queue the job like this
# Game.find_in_batches(:conditions => "thumbnail_file_nam... |
class AddCompletedtimetoTodos < ActiveRecord::Migration
def change
add_column :todos, :completedtime, :datetime
end
end
|
class User < ActiveRecord::Base
has_secure_password
validates_presence_of :password, :on => :create
has_many :projects
def to_s
"#{first_name} #{last_name}"
end
end
|
require 'test_helper'
class RelationshipsControllerTest < ActionDispatch::IntegrationTest
# 作成にはログインユーザーが必要
test "create should require logged-in user" do
# relationshipの数が変わらないことを確認
assert_no_difference 'Relationship.count' do
# POSTリクエスト送信。/relationships(relationships#create)
post relationsh... |
require 'rails_helper'
describe Assignment do
before do
@kristi = create_person
@location = create_location
end
it 'will save a valid assignment' do
assignment = Assignment.create(person_id: @kristi.id, location_id: @location.id, role: 'Manager')
expect(assignment).to be_valid
end
it 'will n... |
class Dog < ActiveRecord::Base
attr_accessible :name, :mother_id, :father_id, :race_id, :male, :gallery_id, :avatar, :birth_date
validates_presence_of :name, :race, :male, :birth_date
belongs_to :father, :class_name => 'Dog'
belongs_to :mother, :class_name => 'Dog'
belongs_to :race
has_one :gallery
has_... |
module Seedify
module Callbacks
TYPES = %w{before_all}
def self.with_callbacks(proc)
@finished_before_all ||= []
proc.class.get_callbacks(:before_all).each do |callback|
unless @finished_before_all.include?(callback)
@finished_before_all << callback
proc.send(callbac... |
require 'spec_helper'
describe User do
context "setting defaults" do
it "sets the default role to 'user' when not defined" do
user = User.make_unsaved
user.save!
user.role.should eql 'user'
end
it "does not set role to default value when defined" do
user = User.make_unsaved(:ro... |
class AddColumnToUsers < ActiveRecord::Migration[5.0]
def change
add_column :users, :name, :string
add_column :users, :sap, :integer
end
end
|
# frozen_string_literal: true
module Importers
class Branches < Importer
self.path = :branches
def hashify_json
json_data.filter { |x| x['short_name'] != 'DNU' }.map do |row|
[
row['id'],
{
name: row['name'].strip,
region: row['short_name'].upcase
... |
#
# Cookbook Name:: carbon
# Recipe:: wso2server_sh
#
# ----------------------------------------------------------------------------
# Copyright 2005-2014 WSO2, Inc. http://www.wso2.org
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licen... |
class RemoveUserIdFromPokemon < ActiveRecord::Migration
def change
remove_column :pokemons, :user_id, :integer
end
end
|
class SuitesController < ApplicationController
# GET /suites
# GET /suites.xml
def index
@suites = Suite.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @suites }
end
end
# GET /suites/1
# GET /suites/1.xml
def show
@suite = Suite.find(par... |
require 'json'
require 'erb'
require 'uuidtools'
require_relative 'base'
class Wrapper
class Html_Document < Wrapper::Base
attr_accessor :arrSubDocs
include ERB::Util
def initialize( boolSubDoc = false, arrSubDocs=nil )
super()
@arrSubDocs = arrSubDocs || Array.new
case boolSubDoc... |
json.array!(@amexes) do |amex|
json.extract! amex, :id, :symbol, :name, :market, :country, :ipo, :sector, :alive, :list_type
json.url amex_url(amex, format: :json)
end
|
class Ability
include CanCan::Ability
def initialize(user)
# Define abilities for the passed in user here. For example:
#
user ||= User.new # guest user (not logged in)
if user.is?(:admin)
can :manage, :all
elsif user.is?(:depositor)
can :download_citation_report, :all
can :... |
Rails.application.routes.draw do
devise_for :users
get 'pocket/connect', to: 'pocket_account#connect', as: :connect_pocket
get 'pocket/new', to: 'pocket_account#new', as: :new_pocket_account
get 'pocket-callback', to: 'pocket_account#callback', as: :pocket_callback
root 'materials#new'
resources :material... |
class AddSiteCustomerLabel < ActiveRecord::Migration
def change
add_column :sites,:description, :string, default:''
add_column :customers,:description, :string, default:''
end
end |
class MigrateXraysToPatientCase < ActiveRecord::Migration
def self.up
add_column :xrays, :patient_case_id, :integer
add_index :xrays, :patient_case_id
Xray.reset_column_information
Xray.find(:all, :conditions => ["xrays.operation_id is not ?", nil]).each do |xray|
xray.update_attributes(:patient... |
require "test_helper"
class QuizSolutionsControllerTest < ActionDispatch::IntegrationTest
setup do
@quiz_solution = quiz_solutions(:one)
end
test "should get index" do
get quiz_solutions_url
assert_response :success
end
test "should get new" do
get new_quiz_solution_url
assert_response ... |
require 'rspec'
require_relative '../config'
describe Teacher, "Sample data" do
it "should contain one of the teachers from the CSV" do
Teacher.where("name = ?", "Dallas Araneda").count.should be >= 1
end
end
describe '#name' do
it "should not allow a duplicate name" do
teacher = Teacher.new(name... |
# log.rb
$logger_depth = 0
def log desc, &block
prefix = " "*$logger_depth
puts prefix + "Beginning " + desc + "..."
$logger_depth += 1
result = block.call
$logger_depth -= 1
puts prefix + "...'" + desc + "' finished, returning: " + result.to_s
end
log 'outer block' do
log 'some little block' do
1**1 + ... |
# Build a simple guessing game
# I worked on this challenge [by myself, with: ].
# I spent [#] hours on this challenge.
# Pseudocode
# Input: A solution, and some guesses
# Output: for guess: high low or correct. For solved: true or false
# Steps: Initialize with a new answer and set that as an instance variable. F... |
# -----------------------------------------------------------------------------
# TEST SETUP
# -----------------------------------------------------------------------------
# Configure Rails and load libraries
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../test/demo/config/environment.rb", __FILE__)
requir... |
#
# Cookbook Name:: ruby_lwrp
# Recipe:: ruby_build
#
# Copyright 2013, LLC Express 42
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation th... |
require 'rails_helper'
describe Idea do
describe "Validations" do
before :each do
@user = build(:user)
end
it "is invalid without a name" do
idea = Idea.new(description: "yah", user: @user)
expect(idea).to_not be_valid
end
it "is invalid without a description" do
idea =... |
Rails.application.routes.draw do
root "static#index"
get '/signup', to: "users#new"
post '/signup', to: "users#create"
get 'about', to: "static#about", as: "about"
get 'search', to: 'alerts#search'
get '/login', to: 'sessions#new'
post '/login', to: 'sessions#create'
delete 'logout', to: 'session... |
class RenameOpidToTxidOnTransactions < ActiveRecord::Migration[5.1]
def change
rename_column :transactions, :opid, :txid
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.