text stringlengths 10 2.61M |
|---|
class CreateUnsignedUsers < ActiveRecord::Migration
def change
create_table :unsigned_users do |t|
t.string :uniq_key
t.string :device_type
t.timestamps
end
end
end
|
module BillGenerator
extend self
def process(json)
init_process(json)
create_bills_list
json = { :bills => @bills }
Json.generate(@level, json)
end
private
def init_process(json)
@bills = []
@level = json.level
@users = json.users
@providers = json.providers
@contracts... |
class CreateMerchants < ActiveRecord::Migration[6.0]
def change
create_table :merchants do |t|
t.string :merchant_name, null: false
t.string :merchant_address, null: false
t.index [:merchant_name, :merchant_address], unique: true
t.timestamps
end
end
end
|
require 'hpricot'
require 'base64'
require 'tempfile'
require 'fileutils'
# Documentation that needs to be turned into code:
# LibraryDomain = /Library
# KeychainDomain = /var/Keychains
# HomeDomain = /var/mobile
# MediaDomain = /var/mobile/Media
module IBackupInfo
# A BackupFile is a single pair of .mddata and .mdi... |
#
# Cookbook Name:: rssbus
# Recipe:: default
#
# Copyright 2013, OPSWAY
#
# All rights reserved - Do Not Redistribute
#
include_recipe "java"
temp_file = "#{node['rssbus']['dir']}/rssbus_src.tar.bz"
remote_file "#{temp_file}" do
source "#{node['rssbus']['source_file_address']}"
mode "0644"
action :creat... |
require_relative 'function_type'
require_relative 'union_type'
class FunctionConstraint
attr_reader :types, :idx
def initialize(types)
@types = types
end
def idx=(idx)
@idx = idx
end
def return_type(*_args)
(@idx + 97).chr
end
def accept?(other)
case other
when FunctionType
... |
class ChangeGithubUidToUid < ActiveRecord::Migration
def up
rename_column :users, :github_uid, :uid
end
def down
rename_column :users, :uid, :github_uid
end
end
|
module PortfoliosHelper
def image_generator(height:, width:)
"https://via.placeholder.com/#{height}x#{width}"
end
def portfolio_image image, type
if image.model.main_image? || image.model.thumb_image?
image
elsif type == 'thumb'
image_generator(height: '200', width: '350')
else
... |
class Prospect < ApplicationRecord
validates :email, presence: true,
uniqueness: {message: "Cet email est déjà utilisé"},
format: { with: /\A[\w+\-.]+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i, message: "Ceci n'est pas un email" }
after_create :send_welcome_email, :new_subscriber
private
def send_welcome_email
... |
require './restaurant.rb'
class Review
attr_accessor :customer, :restaurant, :content
@@all = []
def initialize(content, restaurant, customer)
@@all << self
customer.reviews << self
restaurant.reviews << self
@restaurant = restaurant
@customer = customer
@content = con... |
require 'rails_helper'
RSpec.describe "file_uploads/show", :type => :view, skip: true do
before(:each) do
@file_upload = assign(:file_upload, FileUpload.create!(
:file_name => "File Name"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/File Name/)
end
end
|
class UseJsonb < ActiveRecord::Migration[5.1]
def up
change_column :agents, :source_agent, :jsonb, using: 'source_agent::text::jsonb'
change_column :agent_regression_checks, :expected, :jsonb, using: 'expected::text::jsonb'
change_column :agent_regression_checks, :got, :jsonb, using: 'got::text::jsonb'
... |
require 'rails_helper'
RSpec.describe FacilitiesManagement::Procurement, type: :model do
subject(:procurement) { create(:facilities_management_procurement_detailed_search, user: user) }
let(:user) { create(:user) }
let(:current_year) { Date.current.year.to_s }
let(:time) { Time.now.getlocal }
let(:contract... |
class RemoveFieldNameFromRole < ActiveRecord::Migration
def up
remove_column :roles, :created_at
remove_column :roles, :updated_at
end
def down
add_column :roles, :updated_at, :string
add_column :roles, :created_at, :string
end
end
|
class MessageGroupsController < ApplicationController
before_action :authenticate_user!
before_action :set_message_group, only: %i[ show edit update destroy ]
# GET /message_groups or /message_groups.json
def index
@message_groups = MessageGroup.includes([:owner]).where(owner_id: current_user)
end
# G... |
class BookSerializer < ActiveModel::Serializer
attributes :id, :title, :summary
# has_many :users, serializer: UserSerializer
attribute :users do
object.user_ids.uniq.map do |user_id|
User.find_by(id: user_id).username
end
end
attribute :genres do
object.genre_ids.uniq.map do |genre_id|
... |
require 'test_helper'
class PartnerDetailsControllerTest < ActionDispatch::IntegrationTest
setup do
@partner_detail = partner_details(:one)
end
test "should get index" do
get partner_details_url
assert_response :success
end
test "should get new" do
get new_partner_detail_url
assert_resp... |
module RSpec
module Core
module Extensions
# Extends lists of example groups and examples to support ordering
# strategies like randomization.
module Ordered
def ordered
if RSpec.configuration.randomize?
Kernel.srand RSpec.configuration.seed
sort_by { Ke... |
class ItemOrder < ApplicationRecord
belongs_to :order
belongs_to :item
enum maiking_status: { 製作不可: 0, 製作待ち: 1, 製作中: 3, 製作完了: 4 }
end
|
class Admin::UsersController < ApplicationController
before_filter :require_admin
def index
@users = User.order(:firstname).page(params[:page]).per(1)
end
end
|
class Opinion < ApplicationRecord
def self.search(search)
if search.nil? || search.empty?
@opinions = ""
else
@opinions = OpinionService.parse(search)
end
end
end
|
json.success true
json.query params[:q]
json.categories do
json.array! ["managers", "invite"]
end
json.results do
json.managers do
json.name translate('cms.hints.event.manager.categories.managers')
json.results do
json.array! @records do |manager|
json.category 'manager'
json.title m... |
require 'rails_helper'
RSpec.describe Ride do
describe 'relationships' do
it {should have_many :maintenences}
it {should have_many(:mechanics).through(:maintenences)}
end
end |
class Partner
class OrderSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
attributes [*Order.base_columns, :user, :links]
def user
return {} if object.user_profile.nil?
User::ProfileSerializer.new(object.user_profile).as_json
end
def links
{
... |
# iterate through the month, starting at the first day, checking to see if it is a :weekday, if it is,
# push that days month date to a new array.
# grab the day from the array that we push to include?(args)
# example:
# arr[-1] == last
# arr[0] == first
# arr[1] == second
# arr[2] == third
# arr.select { |x| TEETH.in... |
class Address < ActiveRecord::Base
attr_accessible :description, :user_id
belongs_to :user
end
|
class TaskSerializer < ActiveModel::Serializer
attributes :id, :done, :description
end
|
class Variant < ActiveRecord::Base
belongs_to :product
attr_accessible :name, :value, :product_id
validates :name, :value, presence: true
end
|
class Avatar < ApplicationRecord
belongs_to :user
include Rails.application.routes.url_helpers
has_one_attached :image
def avatar_url
#Get the URL of the associated image
image.attached? ? url_for(image) : nil
end
end
|
require 'pry'
require_relative 'project.rb'
require_relative 'project_backer.rb'
class Backer
attr_reader :name
def initialize(name)
@name = name
end
def back_project(project)
ProjectBacker.new(project, self)
end
def backed_projects
projects = []
ProjectBacker.all.each do |project_backer... |
require 'spec_helper'
describe ScrubDataForBuildingsAndUsers do
before :all do
@original_stdout = $stdout
$stdout = File.open(File::NULL, "w")
end
after :all do
$stdout = @original_stdout
end
describe "address_scrubber" do
it "standardizes common abbreviations" do
address_one = "North... |
class CountWords
def initialize(string)
@string = string
end
def count_words
@string.split.count
end
def count_letters
@string.length
end
def reverse
@string.reverse
end
def uppercase
@string.upcase
end
def lowercase
@string.downcase
end
end
|
require 'test_helper'
class ChannelTest < Test::Unit::TestCase
def subject
@subject ||= Banjo::Channel.new
end
def test_channel
assert_equal 0, subject.channel
end
def test_tick_note_plays
Banjo.tick = 0
mock(subject).play_note(15, 50, 0.5)
subject.tick_note(0, 15)
end
def test_tic... |
class ChangeImageUrlForCategories < ActiveRecord::Migration[5.2]
def change
change_column_default :categories, :image_url, "https://s3.amazonaws.com/ada-student-project-noregretsy/category-default.jpg"
Category.where(image_url: nil).update_all(image_url: "https://s3.amazonaws.com/ada-student-project-noregrets... |
class SchoolGroup < ActiveRecord::Base
has_many :schools
has_many :school_domains, :as=>:linkable, :dependent => :destroy
has_many :gateway_assignees, :as=>:assignee, :dependent=>:destroy
has_many :assigned_packages, :as=>:assignee
has_one :available_plugin, :as=>:associated
has_one :attachment, :as=>:owner... |
# frozen_string_literal: true
require 'hana'
module MLBStatsAPI
class LiveFeed < Base
attr_reader :id
def initialize(api, data)
super(data)
@api = api
# If we need to nuke and start over, keep this piece
@id = data['gamePk']
end
def game_data = @data['gameData']
def ... |
require 'rails_helper'
RSpec.describe 'Links Endpoint', type: :request do
context "as an authenticated user" do
it 'should return a collection of all links' do
user = create(:user)
links = create_list(:link, 3, user: user)
expected_link_1 = links.first
expected_link_3 = links.last
... |
# frozen_string_literal: true
module EVSS
module ReferenceData
class Configuration < EVSS::AWSConfiguration
def base_path
Settings.evss.aws.url.to_s
end
def service_name
'EVSS/AWS/ReferenceData'
end
def mock_enabled?
# TODO: create mock data
false
... |
#!/usr/bin/env ruby
# Collection Iterators
array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
array.each do |e|
puts "number is #{e}"
end
puts ""
array.each.with_index do |element, index|
puts "element number #{index} is #{element}"
end
puts ""
new_array = array.map { |e| e*10 }
p new_array
puts ""
big = array.select { |... |
json.array!(@leave_applications) do |leave_application|
json.extract! leave_application, :id, :application_date, :user_id, :granted
json.url leave_application_url(leave_application, format: :json)
end
|
Booking.destroy_all
FbUser.destroy_all
Intent.destroy_all
Room.destroy_all
Hostel.destroy_all
# ------------------ Create property -----------------
moonhill_hostel = Hostel.new({
name: "Moonhill Hostel",
description: "When the tours, the adventure, the sports o... |
require 'rack/commonlogger'
require 'json'
module Rack
module Requestash
class CommonJsonLogger < Rack::CommonLogger
def initialize(app, logger=nil)
super(app, logger)
end
def log(env, status, header, began_at)
#Access the base class variables with caution; they may not exist
... |
#
# Specifying rufus-tokyo
#
# Tue Jul 21 13:02:53 JST 2009
#
shared 'table' do
it 'should generate unique ids' do
@t.genuid.should.satisfy { |i| i.to_s > '0' }
end
it 'should return nil for missing keys' do
@t['missing'].should.be.nil
end
it 'should accept Array and Hash input' do
@t.siz... |
require 'spec_helper'
require 'property_location_constraint'
describe "PropertyLocationPages" do
subject { page }
describe "PropertyLocation" do
before { visit new_property_location_path }
it { should have_content("Add Property Location")}
it { should have_title("Add Property Location")}
it { should have_c... |
module SpyFu
module Requests
class KssApi
def self.kss_kws(parameters)
SpyFu::Request.new('/apis/kss_api/kss_kws', %i(q r), parameters).send_request
end
# q (required) - a keyword-based query
#
# This is the main input to the API.
# You give a keyword (or keyword-b... |
require_relative './states'
class Contact
Full_Phone_Length = 12
attr_accessor :name, :address_1, :city, :state,
:postal_code, :telephone_number_raw
def initialize(name, address_1, city, state, postal_code,
telephone_number_raw)
@name = name
@address_1... |
class CreateCheckInForm < Form
attribute :email, String
attribute :location, LocationForm
def self.patterns
Settings.patterns
end
def initialize(attrs = {})
attrs[:location] = attrs[:location].first if attrs[:location].is_a?(Array)
super
end
validates :email,
presence: true,
... |
FactoryBot.define do
factory :config do
data_type { "string" }
sequence(:key) {|n| "key#{n}" }
value { FFaker::DizzleIpsum.words.join(' ') }
factory :app_config do
association :owner, factory: :app
end
factory :device_config do
association :owner, factory: :app
end
end
end
|
Rails.application.routes.draw do
# For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
root to: 'pages#home'
get "teams/new", to: "teams#new"
post "teams", to: "teams#create"
get "teams/:id", to: "teams#show", a... |
#!./miniruby
load "./rbconfig.rb"
include Config
srcdir = File.dirname(__FILE__)
$:.unshift File.expand_path("lib", srcdir)
require 'fileutils'
require 'shellwords'
require 'optparse'
require 'optparse/shellwords'
require 'tempfile'
STDOUT.sync = true
File.umask(0)
def parse_args()
$mantype = 'doc'
$destdir = n... |
module FluxHue
module Discovery
# Helpers for N-UPnP discovery of bridges.
module NUPnP
NUPNP_URL = "https://www.meethue.com/api/nupnp"
def nupnp_scan!
agent.get(NUPNP_URL).map { |resp| nupnp_extract(resp) }
end
def nupnp_extract(resp)
resp = resp.dup
... |
class FooController < ApplicationController
def new
@driver = Driver.new
end
def create
@driver = Driver.new(params.require(:driver).permit(:username, :password))
if @driver.save
session[:driver_id] = @driver.id
redirect_to drivers_path
else
render :new
end
end
end
|
class Issue < ActiveRecord::Base
has_many :articles
def to_s
self.school_year.to_s+"-"+(self.school_year+1).to_s+":"+self.number.to_s
end
end
|
class Question < ActiveRecord::Base
belongs_to :quiz
has_many :answers
def correct_answer
answers.find_by_correctness(true)
end
end
|
require 'test_helper'
describe 'scan_processor' do
it 'should process a scan' do
checks_params = { scan: { checks: [
{ check: { checktype_name: 'tls', target: 'localhost', tag:'tag1'}},
{ check: { checktype_name: 'tls', target: 'www.example.com', tag:'tag2'}}
]}}
s = StringIO.new checks_param... |
# frozen_string_literal: true
class Admin::SectionsController < Admin::AdminController
def index
@sections = Section.all
end
def new
@section = Section.new
end
def create
@section = Section.new(section_params)
@section[:template_id] = 1
if @section.save
redirect_to admin_template_... |
# frozen_string_literal: true
RSpec.describe Dry::Logic::Operations::Set do
subject(:operation) { described_class.new(is_int, gt_18) }
include_context "predicates"
let(:is_int) { Dry::Logic::Rule::Predicate.build(int?) }
let(:gt_18) { Dry::Logic::Rule::Predicate.build(gt?, args: [18]) }
describe "#call" d... |
require 'message_analyzer'
class MessageAnalyzerTest < Test::Unit::TestCase
def setup
pattern = /^ご飯[[:space:]|\s]*/
@target = MessageAnalyzer.new(pattern)
end
def test_match
text = 'ご飯'
expected = true
actual = @target.match? text
assert_equal(expected, actual)
end
def test_discord... |
class ClientsController < ApplicationController
before_action :authenticate_user!
def index
@clients = Client.all
end
def new
@client = Client.new
end
def edit
@client = Client.find(params[:id])
end
def create
@client = Client.new(client_params)
if @client.save
redirect_to clients_path
... |
class MultipleResult < ApplicationRecord
belongs_to :multiple
belongs_to :user
end
|
class DateVaccinesController < ApplicationController
# GET /date_vaccines
# GET /date_vaccines.json
# GET /users
def index
@date_vaccines = DateVaccine.all
@users = User.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @date_vaccines }
end
end
# ... |
ActiveAdmin.register_page "Dashboard" do
menu priority: 1, label: proc{ I18n.t("active_admin.dashboard") }
content title: proc{ I18n.t("active_admin.dashboard") } do
columns do
column do
panel "Заказы" do
table_for Order.order(created_at: :desc).limit(10) do
column("Дата... |
#==============================================================================
# State Icon Scroll
# Version: 1.0c
# Author: modern algebra (rmrk.net)
# Date: January 20, 2012
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to se... |
class Result
attr_reader :errs, :data
def initialize(errs=[], data = nil)
@errs = errs
@data = data
end
def success?
return @errs.empty?
end
end
|
require 'minitest/autorun'
require './star_delete.rb'
class TestStarDelete < MiniTest::Unit::TestCase
def test_basic
assert_equal "adp", star_delete("adf*lp")
end
def test_empty_result
assert_equal "", star_delete("a*o")
end
def test_end_points
assert_equal "ec", star_delete("*dech*")
end
def test_adj... |
module TubeHistoriesHelper
def sort_symbol_helper(param)
result = '▲' if params[:sort] == param
result = '▼' if params[:sort] == param + "_reverse"
return result
end
def sort_link_helper(text, param)
key = param
key += "_reverse" if params[:sort] == param
options = {
:url => ... |
# frozen_string_literal: true
require 'logging'
require 'shellwords'
require 'bolt/node/errors'
require 'bolt/node/output'
require 'bolt/transport/sudoable/connection'
require 'bolt/util'
module Bolt
module Transport
class SSH < Sudoable
class Connection < Sudoable::Connection
attr_reader :logger,... |
class UserConfirmationMailer < ActionMailer::Base
default from: "from@example.com"
def deliver_confirmation(user)
@user=user
@url = Rails.configuration.domain + (@user.perishable_token)
mail(to:@user.email, subject: 'Confirm your registration by' + $product_name)
end
end
|
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
def authenticated_user!
if session[:current_user_id].blank?
redirect_to root_url, notice: 'Silahkan login terlebih dahulu'
return
end
end
def non_authenticated_user!
... |
class CoffeeCup
def initialize (amount = 8, max_amount = 12)
@amount = amount
@max_amount = max_amount
end
def amount
@amount
end
def sip!
if @amount == 0
puts "Hey! You need a refill!"
else
@amount -= 1
end
end
def spill!
@amount = 0
end
def refill!
@a... |
class Api::V1::ReviewsController < ApplicationController
def index
@reviews = Review.all
render json: @reviews
end
def show
@review = Review.find(params[:id])
render json: @review
end
def create
@review = Review.create(review_params)
render json: @review
end
def update
@rev... |
class Post < ApplicationRecord
default_scope { order(created_at: :desc) }
validates :body, presence: true, allow_blank: false
validates :username, presence: true
end
|
# == Schema Information
#
# Table name: debit_note_items
#
# id :integer not null, primary key
# debit_note_id :integer not null
# delivered_item_id :integer not null
# qty :integer not null
# item_price :decimal no... |
# frozen_string_literal: true
module HealthQuest
module PatientGeneratedData
module Patient
##
# An object for generating a FHIR Patient resource for the PGD.
#
# @!attribute user
# @return [User]
# @!attribute model
# @return [FHIR::DSTU2::Patient]
# @!attribu... |
class AddPartnerToSwapper < ActiveRecord::Migration[5.0]
def change
add_column :swappers, :partner_id , :integer, :references => "partners"
end
end
|
class SendPostEmailJob < ActiveJob::Base
queue_as :default
def perform(post, email)
# Send email containing the post
PostMailer.create(post, email).deliver_now
end
end
|
Rails.application.routes.draw do
mount UnsFeeder::Engine => "/uns_feeder"
end
|
# frozen_string_literal: true
class Ability
include CanCan::Ability
def initialize(user)
return unless user
can :manage, Availability
cannot :place, Availability
cannot :show_everyone, Availability
can :manage, User, id: user.id
cannot %i[create destroy allocate_roles update_roles show_f... |
class Api::V1::WeeksController < Api::V1::ApiController
before_action :set_week, only: %i[show update destroy]
def index
@weeks = current_user.weeks
end
def show
end
def update
if @week.update(week_params)
render 'show', status: :ok
else
render 'show', status: :unprocessable_entut... |
describe "Hashes" do
it "test the value on a key" do
firstHash = {"2hoch2" => 4, "2hoch3" => 8, "2hoch4" => 16, "2hoch5" => 32}
expect(firstHash["2hoch2"]).to eq 4
expect(firstHash["2hoch3"]).to eq 8
expect(firstHash["2hoch4"]).to eq 16
expect(firstHash["2hoch5"]).to eq 32
end
it "should add new value... |
execute 'install heroku toolbelt' do
command '\curl -sSL https://toolbelt.heroku.com/install.sh | bash -s stable'
end
template File.join(ENV['HOME'], '.oh-my-zsh/custom/heroku-toolbelt.zsh') do
source 'heroku-toolbelt.zsh.erb'
owner ENV['SUDO_USER'] || node['current_user']
action :create_if_missing
only_if {... |
class Api::V1::Customers::InvoicesController < ApplicationController
def index
customer = Customer.find(customer_params[:customer_id])
render json: Invoice.where(customer_id: customer.id)
end
private
def customer_params
params.permit(:customer_id)
end
end
|
class FontKarma < Formula
version "2.000"
sha256 "ebbe01be41c18aed6e538ea8d88eec65bb1bca046afc36b2fc6a84e808bda7e4"
url "https://github.com/itfoundry/karma/releases/download/v#{version}/karma-#{version.to_s.gsub(".", "_")}.zip"
desc "Karma"
homepage "https://github.com/itfoundry/karma"
def install
(shar... |
#!/usr/bin/env ruby
########################################################################################################
# Usage: #
# gitopendiff [-r<left rev>:<right-rev>] [repository] ... |
class CreateTransactionFees < ActiveRecord::Migration
def change
create_table :transaction_fees do |t|
t.column :certificate_id, :integer
t.column :amount_cents, :integer
t.column :currency, :string, :null => false, :default => "USD"
t.timestamps
end
add_index :transaction_fees, :c... |
class UserNotifier < ApplicationMailer
default from: "Laura API <laura-no-reply@yandex.ru>"
def password_recovery user, token
@user = user
@password_recovery_token = token.token
mail(to: @user.email, subject: 'Password recovery instructions')
end
def profile_updated user
@user = user
mail... |
class Api::V1::ProfilesController < ApplicationController
before_action :find_profile, only: [:update]
def index
@profiles = Profile.all
render json: @profiles
end
def create
profile = Profile.create(resume_params)
render json: profile
end
def destroy
Profile.destroy(params[:id])
end... |
class Label < ActiveRecord::Base
attr_accessible :filename, :status, :rating
has_many :matches
has_many :ingredients, :through => :matches
before_validation :init_status, :on => :create
validates :rating, inclusion: { in: [nil, 1, 2, 3, 4, 5]}
def similarity
return 0 if matches.empty?
mat... |
class OauthAccount < ActiveRecord::Base
belongs_to :user
validates :user_id, presence: true
validates :uid, presence: true
validates :provider, presence: true
scope :by_provider, -> (provider) { where(provider: provider) }
end
|
class Job < ApplicationRecord
extend FriendlyId
belongs_to :company
belongs_to :creator, -> { where(role: 'employer') }, class_name: 'User', foreign_key: :user_id
has_many :unread_applications, -> { where(qualified: true, read: false) }, class_name: 'JobApplication'
has_many :unread_qualified_applic... |
module Adebeo::DanielTall_GEMaker
class KmzMaker
attr_accessor
def initialize()
@model = Sketchup.active_model
@options = Adebeo::ExtensionName::getUserOptions()
#get gm terrain
allgroup = @model.entities.grep(Sketchup::Group)
googlemapGroups = allgroup.select{|a| a.name == "Location Snapshot"}
... |
class CreatePrograms < ActiveRecord::Migration
def change
create_table :programs do |t|
t.time :start_time
t.time :end_time
t.date :pdate
t.int :overloads_appointments
t.int :max_appointments_by_hour
t.bool :lock_state
t.references :atention, index: true, foreign_key: tru... |
require 'rest_client'
require "open-uri"
require "yajl"
require 'fileutils'
module Nesta
module Plugin
module Drop
class Client
def self.confirm_linked!
return true if File.exists?("/tmp/.nestadropped")
File.open("/tmp/.nestadropped", "w+") do |f|
f.write "linked"
... |
require 'test_helper'
class SitPetsControllerTest < ActionDispatch::IntegrationTest
setup do
@sit_pet = sit_pets(:one)
end
test "should get index" do
get sit_pets_url
assert_response :success
end
test "should get new" do
get new_sit_pet_url
assert_response :success
end
test "should... |
class Venue < ApplicationRecord
# Extensions
include ActivityMonitorable
include Location
# audited
nilify_blanks
searchable_columns %w[name street city region_code country_code post_code]
# Associations
# belongs_to :country, foreign_key: :country_code, primary_key: :country_code
has_many :area_v... |
class Pawn < Piece
attr_reader :en_passant
def initialize(position, board=nil)
super
@en_passantable = false
@en_passant = []
end
def next_move(position, board)
end
end
class WhitePawn < Pawn
def move1(position)
@position = position
column = position[0]
row = position[1].to_... |
class OperationsPage < GenericBasePage
include DataHelper
#class HeaderPage < GenericBasePage
element(:originatorStatus) {|b| b.link(text: "Originator Status")}
element(:institutionStatus) {|b| b.link(text: "Institution Status")}
end |
require "test_helper"
describe InviteAcceptor do
describe "#accept" do
before do
@tournament = create(:started_tournament)
@invite = create(:invite, tournament: @tournament)
@user = create(:user)
end
it "sets the invite to the user and joins the user" do
InviteAcceptor.new(@invit... |
class DashesController < ApplicationController
before_action :authenticate_user!
def new
redirect_to admin_dash_path if current_user.admin?
redirect_to examiner_dash_path if current_user.staff?
redirect_to student_dash_path if current_user.student?
end
def admin
load_examinees
end
def exa... |
class UserMailer < ActionMailer::Base
require 'mandrill'
ENV["MANDRILL_APIKEY"] = App.mailer["password"]
def charge_success(user, endowment, donation_amount)
m= Mandrill::API.new
user_message = {
:subject=> "[ giv2giv.org ] Thank you for your donation",
:from_name=> "giv2giv.org",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.