text stringlengths 10 2.61M |
|---|
require 'test_helper'
class OrganisatiesControllerTest < ActionController::TestCase
setup do
@organisaty = organisaties(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:organisaties)
end
test "should get new" do
get :new
assert_respons... |
# frozen_string_literal: true
RSpec.describe UserMailer, type: :mailer do
subject(:send!) { mailer.send_password_reset_email(email_address, token) }
let(:email_address) { Faker::Internet.email }
let(:token) { SecureRandom.uuid }
let(:mailer) { described_class.new }
before do
allow(mailer).to receive(:m... |
class MyEventsController < EventsController
layout "dashboard"
before_action :authenticate_user!
def index
@events = current_user.events
@g_events = current_user.recorded_group_events
@events_unconfirmed = @events.unpaid.future.unconfirmed.order(start: :asc).includes(:area, :coach, :event_change, :se... |
class Card
attr_accessor :face_value, :face_down, :display
def initialize(face_value,face_down=true,display=:X)
@face_value = face_value
@face_down = face_down
@display = display
@display = :O if face_down == false
end
def hide
face_down = true
display = :X
end
def reveal
face... |
require "colorize"
class Piece
attr_reader :color, :board
attr_accessor :pos
def initialize(color, board, position)
@color = color
@board = board
@pos = position
end
def moves
potential_moves = []
end
def color_symbol
symbol.colorize(color)
end
e... |
module Kaya
class Execution
# Run/Execute the commmand
# @param [Hash] execution_data = { :suite_id, :label }
def self.run! execution_request_data
if Kaya::Support::Configuration.use_git?
Kaya::Support::Git.reset_hard and Kaya::Support::Git.pull
$K_LOG.debug "Git pulled" if $K_LOG... |
#
# Class User
#
require 'digest/md5'
class User
# -------------------------------------------------------------------
# Constantes
# -------------------------------------------------------------------
unless defined? User::DEFAULT_IP # lors des tests
# Dossier des utilisateurs (note: à l'extérieu... |
class MongoAdapter
def to_photograph(data)
output = Photograph.new
output.photo_id = data["PhotoId"]
output.secret = data["Secret"]
output.title = data["Title"]
output.description = data["Description"]
output.media = data["Media"]
output.date_saved = data["DateSaved"]
output.photograp... |
require 'test_helper'
class UserTest < ActiveSupport::TestCase
def setup
@user = User.new(name: "Example")
end
test "user should be valid" do
assert @user.valid?
end
test "user name cannot be blank" do
@user.name = " "
assert_not @user.valid?
end
end
|
class Api::V1::VendorInvoicesController < Api::V1::BaseApiController
def index
@invoices = Inventory::VendorInvoice.where(purchase_order_id: params[:purchase_order_id])
@invoices = @invoices.where(:invoice_no => /^#{params[:filter]}/i) if params[:filter].present?
@invoices = @invoices.limit(7).map do |x|
... |
class CreatePosts < ActiveRecord::Migration[6.0]
def change
create_table :posts do |t|
t.string :name
t.date :date
t.string :content
t.string :img
t.string :you_link
t.belongs_to :user, null: false, foreign_key: true
t.timestamps
end
end
end
|
gem 'minitest'
require 'minitest/autorun'
require 'minitest/pride'
require './lib/problem'
class ExerciseTest < Minitest::Test
def input
{"letters" => %w(a b c)}
end
def output
{"capitals" => %w(A B C)}
end
def exercise
Problem.new("capitalize", input, output, "letter.upcase")
end
def test... |
# Encapsulates methods that need some business logic
module ItemsHelper
def dollar_value(value, addition = '')
if value.zero?
''
else
addition + ActionController::Base.helpers.number_to_currency(cents_to_dollar(value), precision: cents_to_dollar(value).round == value ? 0 : 2)
end
end
def ... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, and :omniauthable
# timeoutable is used to take the user out if user hasn't done any activity for some time set at config/initializers/devise
devise :database_authenticatable, :registerable, :time... |
require "spec_helper"
module Roadblock
describe PermissionsController do
describe "routing" do
routes { Roadblock::Engine.routes }
it "routes to #index" do
get("/").should route_to("roadblock/permissions#index")
end
it "routes to #index" do
get("/permissions").should rou... |
class Bet < ActiveRecord::Base
has_many :memberships, dependent: :destroy
has_many :members, through: :memberships, source: :user
#
has_many :agree_members, -> { where(memberships: { accepted: true }).where(memberships: { against: false }) }, through: :memberships, source: :user
has_many :against_members, -... |
require 'rubygems'
require 'sinatra'
require 'mongoid'
# Add directories to the load path
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'models'))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'utils'))
# Not sure where the ideal place to put this is.
require 'crimes'
require 'elevations'
require 'accid... |
Rails.application.routes.draw do
post 'user_token' => 'user_token#create'
get '/items/my', to: 'items#my'
get '/items/all', to: 'items#index_all'
resources :books, only: [:update,:show]
resources :items, only: [:create,:update,:destroy,:show,:index] do
resources :books, only: [:create,:update,:destroy,:sh... |
require "spec_helper"
describe ActiveImapMessagesController do
describe "routing" do
it "routes to #index" do
get("/active_imap_messages").should route_to("active_imap_messages#index")
end
it "routes to #new" do
get("/active_imap_messages/new").should route_to("active_imap_messages#new")
... |
require 'spec_helper'
describe SentMailmagazine do
describe "バリデーション" do
it { should validate_presence_of :title }
end
end
|
class FixTypeName < ActiveRecord::Migration
def change
rename_column :users,:type,:user_type
end
end
|
json.extract! @journal, :id, :title, :url_title, :body, :favorites_count, :comments_count, :shares_count, :views_count, :published_at, :updated_at
json.type @journal.class.name
json.tags @journal.tag_list
json.profile do
json.id @journal.profile.id
json.type @journal.profile.class.name
json.name @journal.profile.... |
module Fixtures
# Including Fields directly
class BasicModel
include Moon::DataModel::Fields
field :name, type: String
field :age, type: Numeric
def initialize(opts = {})
initialize_fields(opts)
end
end
class IdModel < Moon::DataModel::Metal
field :id, type: String, default: pr... |
### command line args check ###
lambda{
if ARGV.length < 2
puts "Usage : $ ruby question_04.rb <n:Integer> <threshold:Integer> (<word length:Integer>)"
exit
end
unless ARGV[0].to_i > 0
puts 'n-gramのnには0以上の整数を入力してください.'
exit
end
unless ARGV[1].to_i > 0
puts '出現頻度の閾値には0以上の整数を入力してください.'
... |
class Obdd
attr_accessor :name, :workspace, :number_of_variables, :number_of_nodes, :cache_size, :variable_names,
:clauses_pushed, :periodic_triggered_actions, :current_solution, :retrieved_solution,
:retrieved_dot, # the dot retrieved from buddy as it is
:current_do... |
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32-gui"
config.vm.provision :shell, :path => "cookbook/php5.sh"
config.vm.provision :shell, :path => "cookbook/curl.sh"
config.vm.provision ... |
require 'coffee-script'
module Couchino
module Plugins
class CoffeeScript < Couchino::Plugin
name 'coffeescript'
# Run the coffeescript plugin.
# Available options:
#
# * :files - Run these files through CoffeeScript. Can be an array of patterns
# or a single file... |
module UmsItunes
class IRiverPlaylist
attr_accessor :name, :tracks
def initialize(user_attributes = {})
attributes = {
:name => 'Playlist',
:tracks => []
}.merge(user_attributes)
@name = attributes[:name]
@tracks = attributes[:tracks]
end
de... |
module Webistrano
module Template
module Unicorn
CONFIG = Webistrano::Template::Rails::CONFIG.dup.merge({
:unicorn_init_script => "/etc/init.d/unicorn"
}).freeze
DESC = <<-'EOS'
Get your unicorn on.
EOS
TASKS = Webistrano::Template::Base::TASKS +... |
FactoryGirl.define do
factory :user do
firstname "jane"
lastname "dough"
username "jane"
sequence(:email) { |n| "test#{n}@example.com" }
description "some descriptive stuff!"
password "abcd12345"
end
end
|
class Boost
ERROR_RATE = 0.2
SMALL_NUM = 0.0001
attr_accessor :predictors, :num_predictors, :weights,
:learning_rate, :errors, :samples
def initialize num_predictors
self.num_predictors = num_predictors
self.predictors = Array.new(num_predictors) {
Predictor.new
}
self.weights = Arr... |
require 'json'
require 'sinatra'
require "sinatra/reloader"
require "sinatra/param"
require 'mongoid'
require 'omniauth'
require 'omniauth-twitter'
require_relative 'models/user'
require_relative 'models/subject'
set :bind, '0.0.0.0'
use Rack::Session::Pool unless test?
def get_config(config_name)
relative_path =... |
module Tacho
class Middleware
def initialize app
@app = app
end
def call(env)
Tacho.enable
response = @app.call(env)
Tacho.disable
response
end
end
end |
# frozen_string_literal: true
module AutomaticUpdate
# https://www.usps.org/cgi-bin-nat/grades/trmods.cgi
class TrainingDataRequest < DataRequest
REQUEST_URL = 'https://www.usps.org/cgi-bin-nat/grades/doquery.cgi?%7C%7C%7Ctools'
DOWNLOAD_URL = 'https://www.usps.org/info/temp/0525_trmods.csv'
REQUEST_HE... |
class PoliciesController < ApplicationController
load_and_authorize_resource
rescue_from EndCoverage::PremiumCalcError, with: :redirect_back_with_message
def new
@form = PolicyForm.new(family_id: params[:family_id], household_id: params[:household_id])
end
def show
@policy = Policy.find(params[:id])... |
# encoding: UTF-8
require "yaml"
class DolarHoy::Currency
include Comparable
attr_accessor :name, :buy, :sell
def initialize(name, buy, sell)
@name = sanitize_name(name)
@buy = parse(buy)
@sell = parse(sell)
end
def <=>(other)
self.alias <=> other.alias
end
def parse(text)
text[/... |
#encoding: utf-8
class AssetsController < ApplicationController
before_filter :require_auth
protect_from_forgery :except => [:create, :check]
#
# POST /assets.json
#
# @param File file
# @param String checksum
# @param DateTime taken_at (optional)
# @param String name (optional)
# @param B... |
class CreatePatients < ActiveRecord::Migration
def change
create_table :patients do |t|
t.string :first_name
t.string :last_name
t.decimal :age
t.string :gender
t.string :phone_number
t.text :third_party
t.text :address
t.text :allergy_info
t.text :condition_i... |
class Loaimonan < ApplicationRecord
belongs_to :loai
belongs_to :monan
end
|
class NewSnippetPage < BasePage
TEXT_AREA ||= {:tag_name => 'textarea'}
SUBMIT_BUTTON ||= {:tag_name => 'input'}
def initialize(driver)
super
@driver = driver
raise 'New snippet page not ready' unless
is_displayed?(TEXT_AREA) == true
$LOG.info("Page at #{@driver.current_url} opened.")
... |
class CommandItem < ApplicationRecord
belongs_to :meal_event_command
belongs_to :event_product
end
|
require 'test_helper'
require 'active_record_doctor/tasks/undefined_table_references'
class ActiveRecordDoctor::Tasks::UndefinedTableReferencesTest < ActiveSupport::TestCase
def test_undefined_table_references_are_reported
result = run_task
assert_equal([Contract], result)
end
private
def run_task
... |
class Student < ApplicationRecord
def self.import(file)
CSV.foreach(file.path, headers: true, encoding: 'Shift_JIS:UTF-8') do |row|
#IDが見つかれば、レコードを呼び出し、見つかれなければ、新しく作成
student = find_by(id: row["id"]) || new
#CSVからデータを取得し、設定する
student.attributes = row.to_hash.slice(*updatable_attributes)
... |
require 'rails_helper'
require_relative '../support/devise'
RSpec.describe "/manufacturers", type: :request do
def valid_attributes
{
manufacturer: attributes_for(:manufacturer)
}
end
def invalid_attributes
{
manufacturer: {
name: "",
}
}
end
describe "GET /" do
... |
require 'rails_helper'
RSpec.describe Comment, :type => :model do
before(:each) do
@user = User.create(username: "test", email:'example@example.com', password: 'password')
@photo = Photo.create(title: "photo1", owner: @user)
end
it 'has an author' do
comment = Comment.new(body: "test", photo: @photo... |
require 'spec_helper'
describe Susanoo::ServerSync::Backend::Rsync do
subject { Susanoo::ServerSync::Backend::Rsync.new }
describe "メソッド" do
before do
allow(Susanoo::ServerSync::Backend::Rsync).to receive(:rsync).and_return(['', 0])
end
describe "#push" do
let(:src) { '/path/to/src/' }
... |
class AddFriendsThankingAndContactsThankingToRecommendations < ActiveRecord::Migration
def change
add_column :recommendations, :friends_thanking, :integer, array: true
add_column :recommendations, :contacts_thanking, :json, array: true
end
end
|
require 'rails_helper'
RSpec.describe LegalServices::JourneyController, type: :controller do
login_ls_buyer
describe 'GET #start' do
it 'redirects to the first step in the journey' do
get :start, params: {
journey: 'legal-services'
}
expect(response).to redirect_to(
journey_q... |
class AddFeaturedFlagToPhoto < ActiveRecord::Migration[5.0]
def self.up
add_column :partner_photos, :featured, :boolean
add_index :partner_photos, :featured
end
def self.down
remove_column :partner_photos, :featured, :boolean
end
end
|
class StaffsController < ApplicationController
def new
@staff = Staff.new
end
def create
@staff = Staff.new(staff_params)
@staff.housekeeping_date = Date.today
if @staff.save
redirect_to staffs_path(date: Date.today), notice: "Housekeeping was successfully created."
else
render :n... |
class CreateInvestment < ActiveRecord::Migration[5.2]
def change
create_table :investments do |t|
t.boolean :rounding, default: false
t.boolean :recurring, default: false
t.integer :recurring_amount, {precision: 10, scale: 2}
t.integer :oneoff, default: 0
t.references :account
e... |
$:.unshift File.join(File.dirname(__FILE__),"..","lib")
$:.unshift File.join(File.dirname(__FILE__))
require 'minitest/autorun'
require 'fileutils'
require 'test_helper'
require 'rim/git'
class GitTest < MiniTest::Test
include FileUtils
include TestHelper
def setup
logger = Logger.new($stdout)
lo... |
require 'bcrypt'
class Token < Sequel::Model
include BCrypt
plugin :timestamps, update_on_create: true
plugin :auto_validations, not_null: :presence
many_to_one :user
subset(:valid) { expiry > Time.now }
def before_validation
return super unless self.new?
self.client ||= SecureRandom.urlsafe_b... |
class Publisher < ActiveRecord::Base
# mount_uploaders :image, PublisherImageUploader
translates :title, :info
has_many :products
validates :title, presence: true
end
|
class RegistrationsController < ApplicationController
before_action :destroy, only: [:update, :destroy]
def index
@tournament = Tournament.find(params[:id])
@match = Match.new
@registrations = @tournament.registrations
if params[:search].present?
query = params[:search][:query].nil? ? "" : p... |
require 'rails_helper'
RSpec.describe "reports/index", type: :view do
before(:each) do
assign(:reports, [
Report.create!(
:generate_by => 2,
:unit => false,
:state => false,
:kind => false,
:onu => false,
:blend => false,
:code => false,
:tota... |
require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
def setup
@user=User.new(name:"syfing", email:"13017916017@qq.com", password:"foobar", password_confirmation:"foobar")
end
test "should be valid" do
assert @user.valid?
end
test "name sh... |
Pod::Spec.new do |s|
s.name = "VSocial"
s.version = "1.0.6"
s.summary = "this is a social component, including the login and share of WeChat,weibo,qq"
s.description = <<-DESC
* It is a social component.
* it can help you quickly integrate login and sh... |
class AddDiscountAmountToOrder < ActiveRecord::Migration[5.2]
def change
add_column :orders, :discount_amount, :decimal, precision: 12, scale: 2
end
end
|
title 'server tests'
control 'server' do
impact 1.0
title 'server is verified'
desc 'test that the server is working'
describe filesystem('/') do
its('free_kb') { should be > 5000000 } #5GB free
end
end
|
class Application
include MongoMapper::Document
key :name, String
many :shortcuts
validates_presence_of :name
end |
module Inventory
class MetrcTag
include Mongoid::Document
include Mongoid::Timestamps::Short
belongs_to :facility, class_name: 'Facility'
field :tag, type: String
field :tag_type, type: String # plant, package
# available: Tag is available to use
# assigned: Tag has been assigned to Batch... |
class BlogController < ApplicationController
def login
if request.post?
@usuario = Usuario.find_by_email(params[:usuario][:email])
if @usuario && @usuario.authenticate(params[:usuario][:password])
#usuario valido
session[:usuario] = @usuario.id
redirect_to :action... |
class CreateResponses < ActiveRecord::Migration
def self.up
create_table "responses", :force => true do |t|
t.integer "player_id"
t.integer "answer_id"
t.boolean "correct"
end
end
def self.down
drop_table "responses"
end
end
|
class LocalesController < ApplicationController
before_action :load_locale, only: [:edit, :update, :destroy]
def index
@locales = Locale.all.order_by_name
end
def new
@locale = Locale.new
end
def create
locale = Locale.new locale_params
if locale.save
flash[:success] = t "create_suc... |
module Higo
module Transport
class Abstract
include Transport::Processing
attr_reader :path
attr_accessor :responses, :_raw_file
def initialize(path: nil)
@path = find_file(path)
@_raw_file = {}
@responses = {}
end
# Convenience method for creati... |
class SessionsController < ApplicationController
def create
data = request.env['omniauth.auth']
# Find existing user or create a new user
if User.find_by(uid: data[:uid])
user = User.find_by(uid: data[:uid])
else
user = User.new
end
# Set or update basic variables
user.uid... |
class Updaters::Bitso
BASE_URL = "https://api.bitso.com"
def self.current_balance_for(account)
new(account).run
end
def initialize(account)
@key = account.settings["bitso_key"]
@secret = account.settings["bitso_secret"]
end
attr_reader :key, :secret
def run
calculate_total_from(balance... |
=begin
Glassomium - web-based TUIO-enabled window manager
http://www.glassomium.org
Copyright 2012 The Glassomium Authors
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
h... |
require "chronic"
require "yaml"
require "chronic18n/translator"
module Chronic18n
#
# Try to get a Time object out of a chunk of text.
#
# Chronic18n.parse("hoje", "pt")
# Chronic18n.parse("oggi", "it")
#
# Falls back to Chronic with "en" or w/o params:
#
# Chronic18n.parse("today")
#
def s... |
class AddSwimDistanceToItriRecords < ActiveRecord::Migration
def change
add_column :itri_records, :swim_distance_id, :integer
end
end
|
class User < ApplicationRecord
devise :invitable, :database_authenticatable, :lockable, :recoverable, :rememberable, :trackable, :secure_validatable, :password_expirable, :password_archivable, :timeoutable, :invite_for => 1.week
attr_reader :raw_invitation_token
enum role: [:volunteer, :accompaniment_leader, :ad... |
require File.join(File.dirname(__FILE__), "..", "..", "spec_helper")
describe HBase::Model::CompressionType do
it "should be return the correct type" do
HBase::Model::CompressionType.to_compression_type("RECORD").should == "RECORD"
HBase::Model::CompressionType.to_compression_type("BLOCK").should == "BLOCK"... |
class BiosController < ApplicationController
def index
@bios = Bio.all
@bio = Bio.new
@featured = Bio.find(1)
end
def new
@bio = Bio.new
end
def create
@bio = Bio.new(bio_params)
if @bio.save
redirect_to bios_path
else
... |
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'evtx/version'
Gem::Specification.new do |spec|
spec.name = 'evtx'
spec.version = Evtx::VERSION
spec.authors = ['Cordoba Security']
spec.email = ['opensource@c... |
require_relative 'piece'
require_relative '../sliding_piece'
class Queen < Piece
include SlidingPiece
def initialize(position, color)
@symbol = color == :white ? "♕" : "♛"
super
end
def move_dirs
[
:up, :down, :left, :right,
:diag_ul, :diag_ur, :diag_dl, :diag_dr
]
end
end
|
class Word
attr_accessor :pops, :pushes, :apply
def initialize(pops, pushes, &proc)
@pops = pops
@pushes = pushes
@apply = proc
end
end
|
# frozen_string_literal: true
module Common::Client
module Monitoring
extend ActiveSupport::Concern
def with_monitoring
caller = caller_locations(1, 1)[0].label
yield
rescue => error
increment_failure(caller, error)
raise error
ensure
increment_total(caller)
end
... |
Pod::Spec.new do |s|
s.name = "ATKit"
s.version = "0.0.8"
s.summary = "A collection of iOS components"
s.description = <<-DESC
A collection of iOS components
一些基础类的功能扩展和一些常用的控件封装
DESC
s.homepage = "https://github.com/AesirTitan... |
class Enquiry < ActiveRecord::Base
belongs_to :user
ABOUT = [
'Availability',
'Gifts',
'Wedding Solutions',
'Other'
]
validates :about, :message, presence: true
validates :from_name, :from_email, presence: true, unless: :user_present?
after_create :mail_it
private
def user_present... |
require 'test_helper'
class SessionsControllerTest < ActionController::TestCase
setup do
@kate = users(:kate)
@project_three = projects(:three)
end
test 'should log in' do
post :create, format: 'json', email: 'kcarcia@cs.uml.edu', password: '12345'
puts flash[:debug] if flash[:debug]
assert... |
class Api::V1::UsersController < ApplicationController
def new
@user = User.new
end
def index
@users = User.all.order(:id)
render :index, locals:{users: @users}
# render json:{response: "true",status: "Ok",users: @users}
end
def create
@user = User.new(user_params)
if @user.save
rend... |
class Dorm < ActiveRecord::Base
has_many :rooms
has_and_belongs_to_many :groups
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action do
# CanCan fix
resource = controller_name.singularize.to_sym
method = "#{resource}_params"
if respond_to?(method, true)
params[resource] &&= send(method)
elsif respond_to?('model_... |
class Bash < Package
desc "Bourne-Again SHell, a UNIX command interpreter"
homepage "https://www.gnu.org/software/bash/"
url "http://ftp.gnu.org/gnu/bash/bash-${version}.tar.gz"
release version: '4.4.18', crystax_version: 1
package_info root_package: true
build_copy 'COPYING'
build_options use_standal... |
class PicturesController < ApplicationController
def index
g = Gallery.find_by(gid: params[:gid])
render json: g.pictures, only: [:gid, :page, :startkey]
end
def show
p = Picture.find_by(gid: params[:gid], page: params[:page])
curl = get_with_cookies("#{base_url}/s/#{p.startkey}/#{p.gid}-#{p.pa... |
require_relative '../../../automated_init'
context "Attributes List" do
context "Instance" do
context "Non-Transient" do
example = Schema::Controls::Schema.example
attributes = example.attributes
test "Non-transient attributes are included in the hash" do
assert(attributes == { some_at... |
# frozen_string_literal: true
Puppet::Functions.create_function(:'env_var::get_var') do
dispatch :get do
param 'String', :var
end
def get(var)
ENV[var]
end
end
|
require 'optparse'
require 'yaml'
require 'ostruct'
module CollectdGearman
class Application
CONF_FILE = "/etc/collectd/nagios.yaml"
SEND_GEARMAN_BIN = "/usr/bin/send_gearman"
def self.run
standard_exception_handling do
handle_options
data = read_stdin
send_commands d... |
class ContactListsController < ApplicationController
before_action :set_contact_list, only: %i[edit update destroy]
def index
@contact_lists = current_user.contact_lists
end
def edit
redirect_to contact_lists_path, notice: 'The list is already processed' unless @contact_list.on_hold?
end
def crea... |
require 'spec_helper'
describe CanonicalMake do
before do
@make = CanonicalMake.new(name: 'iPhone', manufacturer: 'Apple')
end
subject { @make }
it { should respond_to(:name) }
it { should respond_to(:manufacturer) }
describe "with valid information" do
it { should be_valid }
end
descr... |
require "spec_helper"
describe "Talk not found", :type => :request do
context "when talk does not exist" do
before do
visit root_path
visit "/talks/00000111111000000111111"
end
it "redirects to the home page" do
expect(current_path).to eql(root_path)
end
end
end |
class Event < ActiveRecord::Base
validates :date, presence: true
validates :name, presence: true
validates :location, presence: true
validates :start, presence: true
default_scope -> { order('date ASC') }
has_attached_file :e_pic, :styles => { :e_cov => "940x300!",
... |
require 'rails_helper'
RSpec.describe "Home", type: :request do
context "when logged out" do
describe "GET index" do
it "should redirect to login page" do
get root_path
expect(response).to redirect_to new_user_session_url
end
end
end
context "when logged in" do
before do
... |
require 'spec_helper'
describe MailUp::Public::Console do
before(:each) { init_mailup }
%w(activate_trial status).each do |method|
it "should have a #{method} method" do
@mailup.public.console.should respond_to(method.to_sym)
end
end
it "should fire the correct POST request for activate_trial" ... |
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "Connection" do
before :each do
user = ENV["ipmiuser"]
pass = ENV["ipmipass"]
host = ENV["ipmihost"]
@conn = Freeipmi.connect(user, pass, host)
end
it "creates a new object" do
@conn.should_n... |
class AddNombreToUsers < ActiveRecord::Migration
def change
add_column :users, :nombre, :text
end
end
|
class TransportImportsController < ApplicationController
before_filter :login_required
filter_access_to :all
before_filter :academic_year_id, :only=>[:index, :create, :search_passengers]
check_request_fingerprint :create
def new
@transport_import = TransportImport.new
@academic_years_to = A... |
# encoding: utf-8
module M17n
def self.string_utf_8
"của_zufällige_žluťoučký_გამეორებ_разлога_和新加坡以及东"
end
end |
class AddPackagingAmountRenameShippingCostInOrder < ActiveRecord::Migration[5.2]
def change
add_column :orders, :total_packaging_amount, :decimal, precision: 12, scale: 2
rename_column :orders, :total_shipping_cost, :total_shipping_amount
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.