text stringlengths 10 2.61M |
|---|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Notifier, type: :mailer do
describe 'instructions' do
let(:user) { create(:user) }
let(:mail) { described_class.cv(user).deliver_now }
it 'renders the subject' do
expect(mail.subject).to eq('CV review')
end
it 'renders t... |
require 'sinatra/base'
require 'sinatra/param/version'
require 'time'
require 'date'
module Sinatra
module Param
Boolean = :boolean
class InvalidParameterError < StandardError
attr_reader :type, :value
MESSAGES = {
required: 'is required.',
blank: 'is blank.',
is: 'is not... |
module Fog
module Google
class Pubsub
class Real
# Delete a topic on the remote service.
#
# @param topic_name [#to_s] name of topic to delete
# @see https://cloud.google.com/pubsub/reference/rest/v1/projects.topics/delete
def delete_topic(topic_name)
@pubsu... |
class ReviewPic < ApplicationRecord
belongs_to :review
scope :filter_by_page, -> (page_param) { page(page_param).per(6) }
end
|
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "versatile_rjs"
s.version = "0.1.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_ru... |
describe StarWars::ImportPeople do
describe "#call" do
subject(:call) { described_class.call }
before do
allow(StarWarsAPI::Swapi::Request).to receive(:new).and_return swapi_api
allow(swapi_api).to receive(:get_people).with(page: 1).once.and_return response
allow(swapi_api).to receive(:get_... |
class RemoveFieldsFromUsers < ActiveRecord::Migration[6.1]
# def change
# remove_column :users, :avatar_file_name
# remove_column :users, :avatar_content_type
# remove_column :users, :avatar_file_size
# remove_column :users, :avatar_updated_at
# end
end |
require 'csv'
CSV.readlines(__FILE__).each { |i| puts i }
@students = [] # an empty array accessible to all methods
def print_header
puts "The students of Villains Academy".center(60)
puts "-------------".center(60)
end
def print_students_list
if @students.count <= 0
return
end
@students.each_with_in... |
require 'minitest/autorun'
require_relative '../../../lib/arcade/intro/the_journey_begins'
class TheJourneyBeginsTest < Minitest::Test
def setup
@this_world = TheJourneyBegins.new
end
def test_add
assert_equal 3, @this_world.add(1, 2)
assert_equal (-37), @this_world.add(2, -39)
... |
class Region
attr_accessor :name
def initialize(name, population, area_size, continent)
self.name = name
self.population = population
self.area_size = area_size
self.continent = continent
end
def greeting
puts name_info + population_info
end
def more_densely_populated?(other_region)
... |
=begin
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
... |
require "codeunion/http_client"
module CodeUnion
# Intent-revealing methods for interacting with Github with interfaces
# that aren't tied to the api calls.
class GithubAPI
def initialize(access_token)
@access_token = access_token
@http_client = HTTPClient.new("https://api.github.com")
end
... |
require 'test_helper'
class JsonSamplesControllerTest < ActionController::TestCase
setup do
@json_sample = json_samples(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:json_samples)
end
test "should get new" do
get :new
assert_respons... |
module NotificationsHelper
def notification_icon(notification)
if notification.disabled?
content_tag :i, nil, class: 'icon-volume-off cred'
elsif notification.participating?
content_tag :i, nil, class: 'icon-volume-down cblue'
elsif notification.watch?
content_tag :i, nil, class: 'icon-v... |
class ReviewsController < ApplicationController
before_filter :authenticate_user!, except: [:index, :show]
def new
@movie = Movie.find(params[:movie_id])
@review = Review.new
end
def create
@movie = Movie.find(params[:movie_id])
@review = @movie.reviews.build(review_params)
@review.use... |
require 'spec_helper'
hiera_file = 'spec/fixtures/hiera/hiera.yaml' # <- required to find hiera configuration file
# test our main class (init.pp)
describe 'stdmodule', :type => :class do
# test without hiera lookup (using class defaults)
context 'without hiera data' do
it { should contain_class('s... |
class AddDefaultToEmailColumnInUsers < ActiveRecord::Migration[5.0]
def change
change_column :users, :reminder_email_sent, :date, default: 20.years.ago
end
end
|
class CardAccount < CardAccount.superclass
module Query
class AnnualFeeDue
def self.call
today = Date.current
current_year = today.year
current_month = today.month
Card.accounts.unclosed.where(
%[date_part('month', "cards"."opened_on") = #{current_month}
... |
namespace :easyproject do
namespace :scheduler do
desc <<-END_DESC
Example:
bundle exec rake easyproject:scheduler:run_tasks RAILS_ENV=production
bundle exec rake easyproject:scheduler:run_tasks force=true RAILS_ENV=production
END_DESC
task :run_tasks => :environment do
force = !... |
class Admin < ApplicationRecord
before_save { self.email = email.downcase }
VALNAME = /[0-9a-z_]{6,12}/i
validates :name, presence: true,length: {maximum: 12 },
format: { with: VALNAME }
VALEMAIL = /[0-9a-z]*@[0-9a-z]*\.[0-9a-z]*/i
validates :email, presence: true, length: { maximum: 256 },
... |
FactoryGirl.define do
factory :rating do
name "arslan"
email "user@user.com"
overall_review "3"
instructor_review "4"
job_assistance_review "1"
curriculum_review "5"
title "this is great"
camp_id 1
description "this is one of the best value of my life and we like to
attend thi... |
class Player < ApplicationRecord
validates :name, presence: true
validates :last_name, presence: true
validates :money, presence:true
has_many :bets
def probability
value = rand()
if value <=0.02
return "green"
elsif value <=0.51
return "red"
... |
class Tag < ActiveRecord::Base
attr_accessible :merchant_id, :category_id
validates :merchant_id, :category_id, presence: true
validates :merchant_id, uniqueness: { scope: :category_id }
belongs_to :merchant
belongs_to :category
end
|
class RemoveTechnicianIdFromInspections < ActiveRecord::Migration
def up
remove_column :inspections, :technician_id
end
def down
end
end
|
class RequestsController < ApplicationController
def create
@request = current_user.requests.build(host_id: params[:host_id])
@request.status = 'Pending host acceptance'
if @request.save
flash[:notice] = 'Request sent.'
redirect_to root_url
else
flash[:notice] = 'Request failed to se... |
# == Schema Information
#
# Table name: leafs
#
# id :integer not null, primary key
# content :text
# provider_id :integer
# image_url :string(255)
# time_stamp :datetime
# weibo_id :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# vide... |
module MLP
class Node
attr_accessor :threshold, :weights
# Takes a threshold_function, which is just an object that
# responds to #call and takes and returns a float.
# an array of weights with one for each input,
# and an optional threshold.
def initialize(threshold_function, weights)
... |
# frozen_string_literal: true
require 'pry'
class TicTacToe
def initialize
@board = Array.new(9, ' ')
end
WIN_COMBINATIONS = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 3, 6],
[1, 4, 7],
[2, 5, 8],
[0, 4, 8],
[6, 4, 2]
].freeze
def display_board
puts " #{@board[0]} | #{@bo... |
require 'spec_helper'
describe WorkRequest do
before(:each) do
@attr = { :name => "Example Name", :email => "edcervenka@yahoo.com", :job_title => "Example job title", :composer_name => "Example composer name", :work_name => "Example work name", :date => "Example date" }
end
it "should create a new instan... |
require File.dirname(__FILE__) + '/../spec_helper'
describe ADCK::Message do
context "message is too long" do
let(:message) {'hello ' *100}
it "should truncate with dots default" do
msg = ADCK::Message.new(body: message, truncate: true)
json = msg.package
MultiJson.load(json)['aps']['ale... |
class Report < ApplicationRecord
belongs_to :reporter, class_name: User.name
belongs_to :reported, polymorphic: true
end
|
require 'weapon'
class BattleBot
@@count = 0
attr_reader :name, :health, :enemies, :weapon
def initialize(name)
@name = name
@health = 100
@enemies = []
@weapon = nil
@dead = false
@@count += 1
end
def self.count
@@count
end
def pi... |
class Discussion < ActiveRecord::Base
belongs_to :Post
validates :content, presence: true, length:
{
minimum: 1,
maximum: 200,
tokenizer: lambda { |str| str.split(/\s+/) },
too_short: "must have at least %{count} words",
too_long: "must have at most %{count} words"
};
end... |
class CreateEventDictionaryEventTags < ActiveRecord::Migration
def change
create_table :event_dictionary_event_tags do |t|
t.integer :event_dictionary_id
t.integer :event_tag_id
t.timestamps
end
end
end
|
require_relative('../db/sql_runner')
# require('pry')
class Member
attr_reader :id
attr_accessor :first_name, :last_name, :membership_type
def initialize(options)
@id = options['id'].to_i if options['id']
@first_name = options['first_name']
@last_name = options['last_name']
@membership_type = op... |
class HourlyData
def initialize(data)
@data = data
end
def decorate
@data.map do |hash|
time = DateTime.parse(hash['DATE_TIME'])
if in_range(time)
build(hash)
end
end.compact
end
private
def highlight(uv)
uv.to_i > 5 ? 'red' : 'default'
end
def in_range(tim... |
class MenusController < ApplicationController
def index
end
def show
# redirect back to index if meal is not specified
unless params[:meal].nil?
@meal = Meal.where(name: params[:meal].downcase).first
# redirect back to index if meal is not found
if @meal.blank?
flash[:warning]... |
class AddIndexToStaffStaffId < ActiveRecord::Migration[5.0]
def change
add_index :staffs, :staff_id, unique: true
end
end
|
require 'nokogiri'
require 'open-uri'
require 'fileutils'
require_relative 'zip'
# this is a shortcut if you have not configured OpenSSL on windows machines.
# For more information, see: https://gist.github.com/fnichol/867550
# require 'openssl'
# OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
class MangaScrap... |
Class Language
def initialize(name, creator)
@name = name
@creator = creator
end
def description
puts "I'm ${@name} and I was created by #{@creator}!"
end
end
class Circle
pi = 3.14159
radius = 0.0
def Circle(r)
radius = r
end
def s... |
class AddColumnsToImport < ActiveRecord::Migration
def self.up
add_column :imports, :messages, :text
add_column :imports, :started_at, :datetime
add_column :imports, :ended_at, :datetime
add_column :imports, :records, :integer
end
def self.down
remove_column :imports, :records
remove_colu... |
# == Schema Information
#
# Table name: messages
#
# id :integer not null, primary key
# body :text
# created_at :datetime not null
# updated_at :datetime not null
# letter_conversation_id :integer
# user_id :int... |
require "set"
class String
def integer?
Integer(self) != nil rescue false
end
end
#---------------Union Method------------------------------------------
puts
p "Union Method"
print "Number of values to enter: "
count = gets.chomp
while !(count.integer?)
print "Number of values to enter: "
count = gets.chomp
e... |
ActiveAdmin.register NormalUser do
index do
selectable_column
column :email
column :name
column :provider
column :sign_in_count
column :created_at
column :updated_at
column :internal_user, label: 'Is his User an TouriMe internal User?'
actions
end
permit_params :email, :passw... |
require 'securerandom'
module Rockauth
class ClientGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../../templates', __FILE__)
desc "Generate a rockauth client"
class_option :environment, default: 'production', desc: 'Environment for the client'
def generate_client
... |
require 'fastlane/action'
require_relative '../helper/ios_flavors_helper'
module Fastlane
module Actions
module SharedValues
IOS_FLAVORS_APP_INPUT = :IOS_FLAVORS_APP_INPUT
IOS_FLAVORS_APP_OUTPUT = :IOS_FLAVORS_APP_OUTPUT
end
class CreateSimFlavorsAction < Action
def self.run(params)... |
require 'rails_helper'
RSpec.describe TokensController do
describe "POST create" do
context 'when params is correct' do
it "creates user token" do
create(:user, id: 1, username: 'ximbinha', password: '12345678')
params = {"username": "ximbinha", "password": "12345678"}
post :create... |
require 'spec_helper'
describe Book do
before do
@valid_attributes = { :title => "Oliver Twist",
:description => "A book about an orphan",
:year => 1838 }
end
it "should be valid with valid attributes" do
book = Book.new(@valid_attributes)
book.s... |
class SnippetTag < ActiveRecord::Base
belongs_to :snippet
belongs_to :tag
end |
require 'rack/rewrite'
require 'spree/core'
module Refinery
module Stores
class Engine < Rails::Engine
include Refinery::Engine
isolate_namespace Refinery::Stores
engine_name :refinery_stores
initializer "register refinerycms_stores plugin" do
Refinery::Plugin.register do |plug... |
FactoryGirl.define do
factory :order do
channel_id { ENV['SELECTED_CHANNELS'].split(',').sample.to_i }
price_in_dollars { rand(0.0...10.0).round(2) }
placement_date { FFaker::Time.date }
legacy_id { rand(0...100) }
end
end
|
json.array!(@user_rankings) do |user_ranking|
json.extract! user_ranking, :id, :user_id, :path, :points
json.url user_ranking_url(user_ranking, format: :json)
end
|
####
#
# Chargeable
#
# Holds information to turn a charge into a debit
#
# Invoicing needs to generate debits from charges.
# It calls on account for due charges and in turn charge
# generates a Chargeable describing a charge that is due
# in the queried date range.
#
# Hashes use symbols as hash keys - faster a... |
require_relative '../spec_helper'
describe "Session" do
describe "login" do
before :all do
User.destroy_all
@user = FactoryGirl.create(:user)
@user.save
end
it "should redirect to first level upon successful login" do
visit '/login'
fill_in 'email', :with => @user.e... |
require 'spec_helper'
describe UserGroup do
#let(:user) { FactoryGirl.create(:user) }
#let(:group) { FactoryGirl.create(:user_group) }
before do
#@user_group = user.user_groups.build()
@user_group = FactoryGirl.create(:user_group)
end
#before { @user_group = user.user_groups.build(name: "MIT") }
subject { @... |
require 'rake/testtask'
require 'rake/extensiontask'
require 'bundler/gem_tasks'
Rake::ExtensionTask.new('byebug') do |ext|
ext.lib_dir = 'lib/byebug'
end
# Override default rake tests loader
class Rake::TestTask
def rake_loader
'test/test_helper.rb'
end
end
desc "Run MiniTest suite"
task :test do
Rake::... |
require "cinch"
require "sequel"
class Karma
include Cinch::Plugin
listen_to :add_karma
def initialize(*)
super
@DB = Sequel.sqlite(File.dirname(__FILE__)+"/../rubee.db")
end
def renderKarma(nick)
nicks = @DB[:karma]
n = nicks.where(:nick => nick.capitalize).first
return "Karma for " + n[:nick] +... |
require 'rails_helper'
RSpec.describe User, type: :model do
let(:user) {
User.create(
name: "Luffy",
email: "luffy@onepiece.com",
password: "password"
)
}
let(:admin) {
User.create(
name: "Nami",
email: "admin@manga.com",
password: "password",
admin: true
... |
class AddDatesToEvents < ActiveRecord::Migration
def change
add_column :events, :sign_up_start, :datetime
add_column :events, :sign_up_end, :datetime
add_column :events, :event_end, :datetime
end
end
|
require 'spec_helper'
describe 'vault' do
let :node do
'agent.example.com'
end
on_supported_os.each do |os, facts|
context "on #{os} " do
let :facts do
facts.merge(service_provider: 'init', processorcount: 3)
end
context 'vault class with simple configuration' do
let(:... |
class ZillowSearch
include Capybara::DSL
def listings
css_selector = '.zsg-photo-card-overlay-link'
find_all(css_selector)
end
def next_page
within find('.zsg-pagination') do
begin
find('.zsg-pagination_active+li').click
rescue Capybara::ElementNotFound
return "end"
... |
module Ricer::Plug::Extender::ForcesAuthentication
OPTIONS ||= {
always: true
}
def forces_authentication(options={always:true})
class_eval do |klass|
merge_options(options, OPTIONS)
klass.register_exec_function(:exec_auth_check!) if options[:always]
def passes_auth_... |
# 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).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel... |
class ChangeMenusRecipeIdNull < ActiveRecord::Migration[5.2]
def change
change_column_null :menus, :recipe_id, true
end
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Adapter::Adapters::Movie do
describe '.new' do
subject(:subject_class) { described_class.new(value) }
context 'when params is valid' do
let(:value) { { query: 'query' } }
it 'response with valid array keys' do
expect(subj... |
class PostPolicy < ApplicationPolicy
attr_reader :user, :post
class Scope < Scope
def resolve
scope.all
end
end
def initialize(user, post)
@user = user
@post = post
end
def edit?
user.owner_admin?(@post)
end
def update?
user.owner_admin?(@post)
end
def destroy?
user.owner_admin?(@post)
... |
require "omniauth"
require "omniauth-bookingsync"
require "bookingsync-api"
module BookingSync
class Engine < ::Rails::Engine
initializer "bookingsync.add_omniauth" do |app|
app.middleware.use OmniAuth::Builder do
provider :bookingsync,
::BookingSyncEngine.support_multi_applications? ? ni... |
# frozen_string_literal: true
module Kenui
VERSION = '2.0.1'
end
|
#
# spec'ing rufus-verbs
#
# Sat Jul 20 22:32:42 JST 2013
#
require 'spec_helper'
describe Rufus::Verbs do
before(:each) do
start_test_server
end
after(:each) do
stop_test_server
end
describe '.get' do
it 'accepts the URI directly' do
r = Rufus::Verbs.get('http://localhost:7777/items... |
class Admin::AudioContentsController < ApplicationController
before_filter :require_admin!
# GET /audio_contents
# GET /audio_contents.json
def index
@audio_contents = AudioContent.all
@audio_mp3s = AudioMp3.all
respond_to do |format|
format.html # index.html.erb
format.json { render... |
module Apohypaton
class ServiceValidationException < StandardError
end
class ServiceExistsException < StandardError
end
class ServiceRegistrationException < StandardError
end
class Service
include ActiveModel::Model
include ActiveModel::Serialization
attr_accessor :name, :checks, :port, :t... |
class AlterFamiliesAddSaldoPrecision < ActiveRecord::Migration
def change
change_column :families, :saldo, :decimal, default: 0.00, precision: 2
end
end
|
class GroupMembersController < ApplicationController
before_action :authenticate_user!
def index
group = Group.find(params[:group_id])
members = if params[:recent].present?
group.members.accepted.order('created_at DESC').limit(14)
else
is_staff = current_user && group.is_staff?(current_user... |
#!/usr/bin/env ruby
# EDOS data building
$: << File.expand_path('../', File.dirname(__FILE__))
$: << File.expand_path('../packages', File.dirname(__FILE__))
require 'yaml'
require 'std/core_ext'
require 'std/mixins'
require 'data_model/load'
require 'moon-mock/load'
require 'std/vector2'
require 'std/vector3'
requ... |
FactoryGirl.define do
factory :song do
sequence(:name) {|n| "Name#{n}"}
description "Details"
end
end
|
class PollsController < ApplicationController
before_action :authenticate_user, except: [:index]
def index
@polls = Poll.all
@current_user = current_user
end
def new
end
def create
params[:poll][:user_id] = current_user.id
@poll = Poll.new(poll_params)
if @poll.save
render json... |
class ReportChoice < ActiveRecord::Base
belongs_to :report_item
has_many :answers
has_many :services, :through => :answers
end
|
class Plug::Api
CSRF_REGEX = /_csrf ?= ?"(.+?)"/i
SOCKET_TOKEN_REGEX = /_jm ?= ?"(.+?)"/i
API_BASE = "https://plug.dj/_"
attr_reader :http
def initialize
@http = HTTPClient.new
end
def login(username, password)
main_page = @http.get_content("https://plug.dj")
match = CSRF_REGEX.match(main_pa... |
class MaintenanceRequestForm < ActiveRecord::Base
belongs_to :ref_maintenance_type
belongs_to :response_user, :class_name => "User", :foreign_key => "response_user_id"
belongs_to :request_user, :class_name => "User", :foreign_key => "request_user_id"
belongs_to :machine
belongs_to :user
before_create :init... |
class TeamSerializer < ActiveModel::Serializer
attributes :name, :id, :tournament_id, :owner, :is_owner, :logo, :registration_date
def is_owner
current_user ? current_user.id == object.user_id : false
end
def logo
object.logo_url
end
def owner
object.user.full_name
end
def registration... |
class Remove < ActiveRecord::Migration
def change
remove_column :tenants, :status, :string
end
end
|
class TasksController < ApplicationController
before_filter :authenticate_user!
attr_accessor :completed
respond_to :html, :xml
def index
@user = current_user
@incomplete = current_user.tasks.incomplete
@task = current_user.tasks.new
respond_with(@incomplete)
end
def showall
@tasks =... |
module Validator
# = Validator::Site
# Validates the site id
class Site < ActiveModel::Validator
TRANSLATION_SCOPE = [:errors, :messages]
def validate(record)
return false if record.site_id.nil?
if ::Site.find_by_id(record.site_id).nil?
record.errors[:base] << I18n.t(:site,
... |
license_key = ask("Please enter your NewRelic RPM license key:")
template = %Q{
#
# This file configures the NewRelic RPM Agent, NewRelic RPM monitors
# Rails applications with deep visibility and low overhead. For more
# information, visit www.newrelic.com.
#
# This configuration file is custom generated for aziz
#
#... |
class Api::V1::HackathonsController < ApplicationController
before_action :find_hackathon, only: [:update]
def index
@hackathons = Hackathon.all
render json: @hackathons
end
def update
@hackathon.update(hackathon_params)
if @hackathon.save
render json: @hackathon, status: :accepted
... |
# frozen_string_literal: true
require 'faker'
class User < ApplicationRecord
VALID_EMAIL_REGEX = /\A([^@\s]{1,64})@((?:[-\p{L}\d]+\.)+\p{L}{2,})\z/i
before_create :set_default_role
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable
has_many :... |
require_relative '../../spec_helper'
feature "Invitations flow" do
let (:gm) {FactoryGirl.create(:dungeonmaster, username: "gamemaester")}
let (:user1) {FactoryGirl.create(:user, username: "filthyanimal")}
let (:user2) {FactoryGirl.create(:user, username: "partyanimal")}
scenario "gamemaster of campaign invit... |
class AddAfternoonToMeetingRooms < ActiveRecord::Migration[5.0]
def change
add_column :meeting_rooms, :afternoon, :boolean
end
end
|
require 'rails_helper'
RSpec.describe 'Cities API' do
let!(:country) { create(:country) }
let!(:state) { create(:state, country_id:country.id) }
let!(:cities) { create_list(:city, 10, state_id:state_id)}
let(:country_id) { country.id }
let(:state_id) { state.id }
let(:id) { cities.first.id }
describe 'G... |
require "formula"
require "language/go"
class Mongodb < Formula
homepage "https://www.mongodb.org/"
stable do
url "https://fastdl.mongodb.org/src/mongodb-src-r3.2.0.tar.gz"
sha256 "c6dd1d1670b86cbf02a531ddf7a7cda8f138d8733acce33766f174bd1e5ab2ee"
go_resource "github.com/mongodb/mongo-tools" do
... |
class DropHairCoefficientsTable < ActiveRecord::Migration
def change
drop_table :haircoefficients
end
end
|
module UI
module Widgets
class RadioEvent < Moon::Event
include Moon::UiEvent
def initialize(parent)
@parent = parent
@target = parent
super :radio
end
end
end
end
|
shared_examples "require_sign_in" do
it "redirects user to the front page if they are not signed in" do
clear_current_user
action
response.should redirect_to front_page_path
end
end
|
class CreateTickets < ActiveRecord::Migration[5.0]
def change
create_table :tickets do |t|
t.string :address
t.string :name
t.integer :phone
t.string :email
t.string :selection
t.integer :flat_nr
t.integer :user_id
t.string :content
t.string :subject
t.t... |
class C0200
attr_reader :options, :name, :field_type, :node
def initialize
@name = "Repetition of Three Words: List three words ('sock', 'blue', 'bed') for resident; number of words repeated after first attempt (C0200)"
@field_type = DROPDOWN
@node = "C0200"
@options = []
@options << Fiel... |
module Fog
module Compute
class Google
class InstanceTemplate < Fog::Model
identity :name
attribute :kind
attribute :self_link, :aliases => "selfLink"
attribute :description
# Properties is a hash describing the templates
# A minimal example is
# :pro... |
class AppMailer < ApplicationMailer
# sends copy of release to current_user
def send_release_copy(user_id)
@user = User.find(user_id)
@company = Company.first
mail(to: @user.email, subject: 'Your copy of our release')
end
# sends notification to user that
# admin created a media_file
def user_... |
namespace :legacy do
desc "Migrate legacy data to the rails database"
task :migrate => :environment do
DataMigrator.migrate_all ENV['WORKFILE_PATH']
end
end
|
class ServiceGroup < ApplicationRecord
belongs_to :company
validates :title, presence: true, length: {maximum: 50, minimum: 5}
end
|
require 'rails_helper'
RSpec.describe AddressOrder, type: :model do
before do
@address_order = FactoryBot.build(:address_order)
end
describe "商品購入" do
context "商品購入がうまくいくとき" do
it "建物名が空でも購入できる" do
@address_order.building = nil
expect(@address_order).to be_valid
end
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.