text stringlengths 10 2.61M |
|---|
require 'test_helper'
class ApplicationViewTest < ActiveSupport::TestCase
test 'make tags for one image' do
url = 'https://partycity6.scene7.com/is/image/PartyCity/_pdp_sq_?$_1000x1000_$&$product=PartyCity/P590860'
tags = 'test, test2'
image = Image.create(url: url, tag_list: tags)
view_model = Appli... |
module Recliner
module AttributeMethods
module Dirty
extend ActiveSupport::Concern
include ActiveModel::Dirty
included do
alias_method_chain :save, :dirty
alias_method_chain :save!, :dirty
end
# Attempts to +save+ the record and clears changed at... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
belongs_to :university, optional: true
has_many :vot... |
class AvailabilityDecorator
include ActionView::Helpers::DateHelper
attr_reader :availability
def initialize(availability, opts={ })
@availability = availability
@timezone = opts[:timezone]
@user_timezone = opts[:user_timezone]
@start_time = opts[:start_time]
@end_time = opts[:end_time]
@... |
# Schema
# t.string "name", :null => false
# t.string "product_code", :null => false
# t.text "description", :null => false
# t.decimal "price", :precision => 10, :scale => 0, :n... |
require 'spec_helper'
module Alchemy
describe Admin::AttachmentsController do
before do
sign_in :user, FactoryGirl.create(:admin_user)
end
describe "#index" do
it "should always paginate the records" do
Attachment.should_receive(:find_paginated)
get :index
end
... |
class AddBibtexFieldsToSource < ActiveRecord::Migration[5.0]
def change
add_column :sources, :bibtex_key, :string
add_column :sources, :isbn, :string
add_column :sources, :doi, :string
add_column :sources, :editors, :text
add_column :sources, :subtitle, :string
add_column :sources, :shorttitle... |
#!/usr/bin/ruby
require 'euler_helper.rb'
i = 1
def test i, number
(0...number).to_a.all?{|n| factorize(i+n).uniq.size == number}
end
benchmark do
until test(i,4) do
i+=1
end
puts i
end
|
class SqlChallengesController < ApplicationController
def show
@challenge = Challenge.find(params[:id])
render :show
end
end
|
class Fakehashwrapper
attr_accessor :fakehash
def initialize(args={})
@fakehash = Hash["blake", "the best"]
end
def trial
fakehash.inject({}){|memo, (k, v)| memo[k.to_sym] = v; memo}
end
end
fh = Fakehashwrapper.new()
#def trial(&block)
# if block_given?
# yeild
# else
# return some_hash
#... |
class UserMailer < ApplicationMailer
def activation_email(user, url)
@user = user
@url = url
mail(to: @user.email, subject: I18n.t("emails.activation.subject", locale: @user.locale))
end
def forgot_password_email(user, url)
@user = user
@url = url
mail(to: @user.email, subject: I18n.t... |
require 'spec_helper'
feature "User adds players to a game", %Q{
As an authenticated user
I want to become a player in a game
so that I can create a character
} do
# Acceptance Criteria:
# * I must be logged in and join a valid game.
# * If I am not logged in or do not specify a valid game, an error is di... |
class CardInteractor
attr_reader :card_repository
class InvalidUserError < StandardError; end
class InvalidNameError < StandardError; end
class CardNotFound < StandardError; end
def initialize(card_repository: CardRepository.new)
@card_repository = card_repository
end
def create(user, name, tasks: ... |
class UsersController < Devise::RegistrationsController
before_filter :authenticate_user!
skip_before_filter :check_need_for_additional_information, only: [:additional_information, :update]
def additional_information
@user = current_user
redirect_to profile_path if @user.completed?
end
def new
@... |
class Api::ListsController < ApplicationController
before_action :require_logged_in
def show
@user = User.find(params[:id])
@movies = @user.movies
render :show
end
def create
@user = User.find(params.require(:data).permit(:id)[:id])
@movie = Movie.find(media_par... |
class BaseController < ActionController::Base
protected
# will check for sudomain presence and correct subdomain
def check_subdomain
if(request.subdomain.present? || current_company.present?)
current_company.present? ? check_current_company_domain : (redirect_to current_path_without_subdomain)
end... |
require 'amazon/ecs'
# Amazon4Rails
module ThirdDay
module Amazon4Rails
def self.included(mod)
mod.extend(ClassMethods)
end
module ClassMethods
def acts_as_amazonable
class_eval do
extend ThirdDay::Amazon4Rails::SingletonMethods
end
end
... |
require "nokogiri"
require "open-uri"
module XSD
attr_accessor :xsd, :presentation, :label, :xbrl
def get_taxonomy(dir, language)
@language_pattern = set_language_pattern(language)
get_presenters_files(dir)
get_edinet_files(@xsd)
end
def set_language_pattern(language)
case langua... |
require 'spec_helper'
describe 'balloons/index' do
let(:loon_link) { 'https://www.google.com/loon' }
before do
render
end
subject { rendered }
it { should have_selector 'h2' }
it { should have_link 'Loon page', href: loon_link }
it { should have_link 'All Balloons', url_for(balloons_path) }
end
|
# -*- coding: utf-8 -*-
require 'rubygems'
require 'test/unit'
$LOAD_PATH << "#{File.dirname(__FILE__)}/../lib/"
require 'handsoap/parser.rb'
def var_dump(val)
puts val.to_yaml.gsub(/ !ruby\/object:.+$/, '')
end
# Amazon is rpc + literal and is self-contained
# http://soap.amazon.com/schemas2/AmazonWebServices.wsdl... |
require 'spec_helper'
describe "MongoDoc::Contexts::Mongo" do
class Address
include MongoDoc::Document
include MongoDoc::Matchers
attr_accessor :number
attr_accessor :street
end
let(:criteria) { Mongoid::Criteria.new(Address) }
let(:context) { criteria.context }
context "#initialize" do
... |
require "rails_admin/config/actions"
require 'rails_admin/config/actions/index_nested'
require 'rails_admin/config/actions/show_nested'
require 'rails_admin/config/actions/show_in_app_nested'
require 'rails_admin/config/actions/history_show_nested'
require 'rails_admin/config/actions/history_index_nested'
require 'rail... |
require 'CSV'
class Stats
attr_reader :game_stats_data,
:game_teams_stats_data,
:teams_stats_data
def initialize(game_stats_data, game_teams_stats_data, teams_stats_data)
@game_stats_data = self.game_stats
@game_teams_stats_data = self.game_teams_stats
@teams_stats_data = s... |
require 'rails_helper'
class Dummy
include RailsEasyCaching
def dummies
[1,2,3]
end
cached :dummies
def super_dummies
OpenStruct.new({
:im => 'so dumb',
:youre => 'not'
})
end
cached :super_dummies, attrs: [:im]
def id
1
end
def reload
self
end
end
describe '... |
require File.expand_path('../lib/omniauth-saml/version', __FILE__)
Gem::Specification.new do |gem|
gem.name = 'omniauth-saml'
gem.version = OmniAuth::SAML::VERSION
gem.summary = 'A generic SAML strategy for OmniAuth.'
gem.description = 'A generic SAML strategy for OmniAuth.'
gem.licens... |
# I worked on this challenge by myself
# This challenge took me 1 hours.
# Pseudocode
# 1. define super_fizzbuzz which takes an array as argument
# 2. each method to iterate over each element; if divisible by 15, then "FizzBuzz", if divisible by 3 then "Fizz", if divisible by 5 then "Buzz"
# 3. else, put the number i... |
# frozen_string_literal: true
# Released under the MIT License.
# Copyright, 2019-2023, by Samuel Williams.
module Async
module REST
module Wrapper
class Generic
# @param payload [Object] a request payload to send.
# @param headers [Protocol::HTTP::Headers] the mutable HTTP headers for the request.
... |
require 'optparse'
# https://ruby-doc.org/stdlib-2.4.2/libdoc/optparse/rdoc/OptionParser.html
# default values
@options = {
verbose: false
}
required_opts = [:color]
OptionParser.new do |opts|
opts.banner = "Usage: first_cli.rb -v -c red -n 1234"
opts.on("-v", "--verbose", "verbose logging") do # boolean ... |
# L7-004 工廠的某台印表機只能印出 a 到 m 的字,請完成實作內容,把不應該出現的字算出來
def printer_error(s)
# h = s.split("").reject { |x| x < "n" }.length
# "#{h}/#{s.length}"
#龍哥方法
"#{s.scan(/[^a-m]/).length}/#{s.length}"
end
# L7-005 一夥人去吃飯,大家先各自付帳,待後續再計算多退少補,請根據輸出結果完成以下實作。
def split_the_bill(bill)
avg = bill.values.sum / bill.count.to_f
... |
class DestinationsController < ApplicationController
before_action :find_destination, only: [:show, :edit, :destroy, :update]
before_action :authenticate_redactor!, only: [:new, :edit]
def index
if params[:category].blank?
@destinations = Destination.all.order("created_at DESC")
... |
describe "Checkbox View Tests" do
before(:all) do
show_control :checkbox_view
@app = App.get_instance
page = @app['checkboxViewsPage']
@basic_checkbox = page['basicCheckboxView', CheckboxView]
@mixed_state_checkbox = page['mixedStateCheckboxView', CheckboxView]
@reset_button = page['reset... |
FactoryBot.define do
factory :additional_information do
title { FFaker::Lorem.word }
description { FFaker::Lorem.paragraph }
portfolio
end
end |
require_relative '../test_helper'
class WorkspacesControllerTest < ActionController::TestCase
def setup
@controller = Api::V2::WorkspacesController.new
super
@t1 = create_team name: 'Test 1'
@u = create_user
create_team_user team: @t1, user: @u
@t2 = create_team name: 'Test 2'
@a = create... |
class CreateUserMeetingAvailabilities < ActiveRecord::Migration[5.2]
def up
create_table :user_meeting_availabilities do |t|
t.integer "user_id" #User ID
t.integer "meeting_id" #Meeting ID
t.string "status", :limit => 200 #Status
t.timestamps #audit
end
end
def down
drop_tabl... |
class AddOpenedToProfessions < ActiveRecord::Migration
def change
add_column :refinery_fg_professions, :opened, :boolean, :default => true # 是否开课
end
end
|
class AdminsController < ApplicationController
before_action :authenticate_user
def home
if current_user.admin
@admin = current_user
render :admin
else
render json: { message: "You're not authorized to access this resource" }, status: :unauthorized
end
end
def verify_admin
i... |
#schools.rb
#Just a short script to create the text files for creating
#the Hash that will map school names to their html names
#used by Assist
require 'rubygems'
require 'nokogiri'
require 'open-uri'
page = Nokogiri::HTML(open('http://www.assist.org/web-assist/welcome.html'))
lines = IO.readlines("school_keys.txt")
... |
class Boat < ActiveRecord::Base
belongs_to :captain
has_many :boat_classifications
has_many :classifications, through: :boat_classifications
def self.first_five
@boats = Boat.limit(5) #.reverse
end
def self.dinghy
@boats = Boat.where("length < ?", 20)
end
def self.ship
@b... |
#in conjunction with CascadedEventJoin this allows a simple way for Events from child objects to be associated to
#their ancestors, as defined by the parent option of cascades_events. When an event that is cascadable is created for
#an object then if that object includes CascadedEventable then a CascadedEventJoin is cr... |
require 'spec_helper'
describe "UserGroupPages" do
subject { page }
shared_examples_for "all user group pages" do
it { should have_selector('h1', text: heading) }
it { should have_selector('title', text: full_title(page_title)) }
end
describe "list user groups page" do
let(:user) { FactoryGirl.create(:user... |
class Track < ActiveRecord::Base
belongs_to :tracker, class_name: "User"
belongs_to :tracked, class_name: "User"
attr_accessible :tracker_id, :tracked_id
end
|
require('minitest/rg')
require('minitest/autorun')
require_relative('./library')
class LibraryTest < MiniTest::Test
def setup()
@books = [
{
title: "lord_of_the_rings",
rental_details: {
student_name: "Jeff",
date: "01/12/16"
}
},
{
title: "... |
require 'spec_helper'
describe 'pam_pkcs11::pkcs11_eventmgr', :type => :class do
shared_examples_for 'an OS that uses systemd by default' do
it { is_expected.to contain_file('pkcs11_eventmgr.service') }
end
shared_examples_for 'an OS that does not use systemd by default' do
it { is_expected.not_to conta... |
class SamplesController < ApplicationController
before_action :set_sample, only: [:show, :edit, :update, :destroy]
def index
@samples = Sample.all
end
def show
end
def new
@sample = Sample.new
end
def create
@sample = Sample.create! params[:sample... |
require 'spec_helper'
require_relative '../src/color.rb'
describe Paint do
describe '#color' do
it 'returns a string' do
expect(Paint.color(1)).to be_kind_of(String)
end
end
end
describe Proximity do
let(:proximity){Proximity.new}
let(:proximity_exact){Proximity.new(:type => :exact)}
let(:proximity_close... |
class MaintenanceHistory < ApplicationRecord
belongs_to :car
belongs_to :user_car_setting
has_many :cost_details, dependent: :destroy
has_many_attached :images, dependent: :destroy
validates :car_id, :estimated_km, :maintenance_type, :scheduled_date, :status, :user_car_setting_id, presence: true
... |
#GET request
get '/sample-29-how-to-use-filepicker-io-to-upload-document-and-get-it\'s-url' do
haml :sample29
end
#POST request
post '/sample-29-how-to-use-filepicker-io-to-upload-document-and-get-it\'s-url' do
#Set variables
set :client_id, params[:clientId]
set :base_path, params[:serverType]
s... |
module Ean
class API
attr_accessor :key,
:cid,
:secret,
:version,
:locale,
:minor_rev,
:currency_code,
:customer_session_id,
:customer_ip_address,
:cust... |
class FollowersController < ApplicationController
before_action :find_user, only: [:index]
def index
@users = @user.followers.page params[:page]
end
protected
def find_user
@user = User.find_by id: params[:user_id]
unless @user
flash[:error] = "ユーザーは存在しません"
redirect_to root_path
... |
class CreateMessages < ActiveRecord::Migration[5.1]
def up
create_table :messages, id: false do |t|
t.bigint :id
t.text :content, null: false
t.bigint :author_id, null: false
t.timestamps null: false, default: -> { "NOW()" }
end
execute "ALTER TABLE messages ADD PRIMARY KEY (id);... |
# frozen_string_literal: true
module Carrierwave
module Google
module Storage
VERSION = '0.7.3'.freeze
end
end
end
|
require './application'
require 'test/unit'
require 'rack/test'
require 'json'
ENV['RACK_ENV'] = 'test'
class AppTest < Test::Unit::TestCase
include Rack::Test::Methods
include Convert
def app
Sinatra::Application
end
def setup
super
#每个测试前清空数据库
#Todo.truncate
end
def test_get_all_todo
@todo=Todo.new(... |
require "haml"
require "cgi"
require "fileutils"
require "active_support/inflector"
require "pathname"
require "base64"
require "redcloth"
require "redcarpet"
require "coderay"
module Sno
class Extractor
@@file_matchers = []
@@directory_matchers = []
@@ignore_patterns = []
attr_accessor :file_path
... |
require 'rails_helper'
describe 'as a visitor' do
context 'when i visit /signup' do
it 'shows me a form to enter my information' do
visit '/signup'
expect(page).to have_content("Signup!")
expect(page).to have_content("Email")
expect(page).to have_content("Password")
expect(page).to ... |
# frozen_string_literal: true
module BusRouteImporter::RecordFactory
extend ActiveSupport::Concern
STOP_TYPES = %w[pickup dropoff].freeze
private
def find_or_create_records
pipe.call(
find_or_create_bus_stop,
find_or_create_bus_route,
find_or_create_route_stop,
find_or_create_ride... |
class ListsController < ApplicationController
before_action :set_list, only: [:show, :edit, :update, :destroy, :get_items]
def index
current_month = Time.now.strftime("%-m")
last_month = (Time.now - 1.month ).strftime("%-m")
month_before_last = (Time.now - 2.month ).strftime("%-m")
@current_month_... |
class Paragraphtype < ApplicationRecord
has_many :paragraphs
has_many :questionsets
has_many :sentences, through: :paragraphs
has_many :questions, through: :questionsets
validates :name, presence: true, uniqueness: true
end
|
# frozen_string_literal: true
require 'pdf/format'
require 'gruff'
module Pdf
class Data
include ERB::Util
def initialize(account, service, options)
raise ArgumentError,'No period supplied' unless options[:period]
@account = account
@service = service
@period = options[:period]
... |
require "formula"
class Valabind < Formula
homepage "http://radare.org/"
head "https://github.com/radare/valabind.git"
url "https://github.com/radare/valabind/archive/0.9.0.tar.gz"
sha1 "65af558a0116c1d8598992637cfd994cc7e23407"
bottle do
cellar :any
sha1 "960e67a45a8b486e4d38d2d8bbfd16a93658f747" =... |
puts "Hello, World!"
# Examples of symbols
:name
:a_symbol
:"surprisingly, this is also a symbol"
# Ex. 1: with double quotes
"The man said, 'Hi there!'"
# Ex 2: with single quotes and escaping
'The man said, \'Hi there!\''
# Examples of symbols
puts :name
:a_symbol
:"surprisingly, this is also a symbol"
# Exam... |
class CreateMarksheets < ActiveRecord::Migration
def change
create_table :marksheets do |t|
t.integer :tamil
t.integer :english
t.integer :maths
t.integer :science
t.integer :social_science
t.integer :student_id
t.timestamps
end
end
end
|
require 'spec_helper'
describe ApplicationHelper do
describe "full_title" do
it "should end with the page title" do
full_title("foo").should =~ /foo$/
end
it "should begin with the site title" do
full_title("foo").should =~ /^Ruby on Rails Tut/
end
it "should not include a pipe wher... |
Pod::Spec.new do |s|
s.name = 'MusicSearch-Framework'
s.version = '0.1.0'
s.summary = 'Itunes Music search based on search term framework'
s.description = <<-DESC
Itunes Music search based on search term framework
DESC
s.homepage = 'https://github.com/gaurangjogi/MusicSearch... |
#!/usr/bin/env ruby
#
# Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
#
# License:: 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.ap... |
class FoodsController < ApplicationController
def index
@foods = Food.all
end
def show
@food = Food.find(params[:id])
end
def new
@food = Food.new
end
def create
@food = Food.new(food_params)
if @food.save
redirect_to @food
else
render 'new'
end
end
private
def food_params
params.... |
# Main model states API serializer
class StateSerializer < ActiveModel::Serializer
attributes :id, :name, :order
end
|
require 'test/unit'
# def solution(s)
# return 0 if s.empty?
#
# total = 0
# ('A'..'Z').to_a.each do |c|
# total += s.count(c)
# end
#
# total + 1
# end
def solution(s)
return 0 if s.empty?
t = 0
('A'..'Z').to_a.each do |c|
t += s.count(c)
end
t + 1
end
class Tests < Test::Unit::TestCase... |
class BrochureSubsection < ActiveRecord::Base
belongs_to :agency
belongs_to :brochure_section
has_many :programs
attr_accessible :agency_id, :brochure_section_id, :name, :active, :description, :user_stamp
validates :agency_id, :brochure_section_id, :name, :active, :user_stamp, :presence => true
end
|
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes... |
Rails.application.routes.draw do
root "page#index"
authenticate :admin_user do
mount Sidekiq::Web => "/sidekiq"
end
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
namespace :api do
namespace :v1 do
get "coupons", to: "coupons#index"
delete "coupons", to: ... |
require_relative './test_helper'
class DealTest < ActiveSupport::TestCase
setup do
Rubspot::API_KEY = "demo"
Rubspot::PORTAL_ID = 62515
end
test 'initializing a deal' do
deal = Rubspot::Deal.new(companies: [8954037], vids: [27136], portal_id: 62515, dealname: 'OldNewDeal')
assert_equal 62515, ... |
class CargoTrain < Train
TRAIN_TYPE = 'Грузовой'.freeze
attr_reader :type, :number
def initialize(number)
super
@type = 'cargo'
validate!
end
def readable_type
TRAIN_TYPE
end
def attachable_car?(car)
car.is_a?(CargoCar)
end
end
|
class Player
def initialize(name)
@name = name
end
attr_reader :name, :guess, :wins
# Simply asks player for a guess and returns the answer
def guess
p "Hey #{self.name} make a guess! (Has to be a single letter ;))"
guess = gets.chomp.downcase
g... |
FactoryGirl.define do
factory :ownership do
sequence :email do |n|
"ruby#{n}@mail.com"
end
owner { create :user }
laser_gem
end
end
|
class Loan < ActiveRecord::Base
belongs_to :user
belongs_to :game
attr_accessible :game, :status, :user
STATUS_ONHOLD = 1
STATUS_ONLOAN = 2
STATUS_COMPLETED = 3
scope :active, where(status: [Loan::STATUS_ONHOLD, Loan::STATUS_ONLOAN])
scope :held, where(status: Loan::STATUS_ONHOLD)
s... |
class TransitionLandingPageController < ApplicationController
skip_before_action :set_expiry
before_action -> { set_expiry(1.minute) }
around_action :switch_locale
def show
setup_content_item_and_navigation_helpers(taxon)
render locals: {
presented_taxon: presented_taxon,
presentable_sect... |
class RenameStyleType < ActiveRecord::Migration
def up
rename_column :area_categories, :style_type, :style_type_cd
end
def down
rename_column :area_categories, :style_type_cd, :style_type
end
end
|
require "aethyr/core/actions/commands/emotes/emote_action"
module Aethyr
module Core
module Actions
module Eh
class EhCommand < Aethyr::Extend::EmoteAction
def initialize(actor, **data)
super(actor, **data)
end
def action
event = @data
... |
module AttrAbility
module Model
class ClassProxy
instance_methods.each { |m| undef_method m unless m =~ /(^__|^send$|^object_id$)/ }
def initialize(klass, sanitizer)
@klass = klass
@sanitizer = sanitizer
end
def new(attributes = nil, options = {})
@klass.new.as(@s... |
require 'spec_helper'
describe JSONAPI::Configuration do
it { expect(JSONAPI.configuration).to be_an_instance_of(described_class) }
describe 'instance methods' do
before do
@original_config = JSONAPI.configuration.dup
end
after do
JSONAPI.configuration = @original_config
end
let(:... |
module Place
module ClassMethods
def highest_ratio_res_to_listings
self.all.max {|city1, city2| city1.res_to_listings <=> city2.res_to_listings }
end
def most_res
self.all.max { |city1, city2| city1.reservations.count <=> city2.reservations.count}
... |
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable,
:confirmable, :lockable, :timeoutable, timeout... |
#正規表現 意味論
require './class_2'
require './class_3-0'
class Empty
def to_nfa_design
start_state = Object.new
accept_states = [start_state]
rulebook = NFARulebook.new([])
NFADesign.new(start_state, accept_states, rulebook)
end
end
class Literal
def to_nfa_design
start_state = Object.new
accept_state = Ob... |
#!./chorus_installation/bin/ruby
require_relative 'chorus_installation/packaging/install/version_detector'
require_relative 'chorus_installation/packaging/install/chorus_logger'
require_relative 'chorus_installation/packaging/install/installer_io'
require_relative 'chorus_installation/packaging/install/chorus_installe... |
FactoryBot.define do
factory :user_reward do
redeemed { false }
identifier { SecureRandom.hex(20) }
association :user, factory: :user
association :reward, factory: :reward
end
end |
module ProjectsHelper
def nav_tabs(active_tab = :not_active, **opts)
content_tag :ul, class: "nav nav-tabs nab-justified #{opts[:class]}" do
active_tabs(active_tab)
end
end
def active_tabs(active_tab, &block)
defects_tab = nav_tab_item(:defects, {active: active_tab == :defects}, {})
tim... |
class DropTaskToTflow < ActiveRecord::Migration[6.1]
def change
remove_column :tflows, :task_id, :references
end
end
|
require "spec_helper"
describe AdaptivePayments::PayRequest do
it_behaves_like "a RequestEnvelope"
subject { AdaptivePayments::PayRequest }
its(:operation) { should == :Pay }
let(:request) do
AdaptivePayments::PayRequest.new(
:receivers => [ { :email => "receiver1@site.com",... |
require 'rails_helper'
RSpec.describe 'Tasks', type: :system do
let(:user) {create(:user)}
let(:task) {create(:task, user: user)}
describe '業務スレッドの閲覧テスト' do
context '業務スレッドの一覧画面' do
it 'スレッドが表示される' do
task
login(user)
visit tasks_path
expect(page).to have_content '確定申... |
require_relative '../test_helper'
require_relative '../../lib/uploaders/asset_uploader'
require_relative '../../lib/models/asset'
describe 'Upload a file' do
include Rack::Test::Methods
def app
API::App
end
file_path = fixture_path('photo.zip')
before do
post '/files',
{
file: ... |
class CreateFinalClaimCostCalculationTables < ActiveRecord::Migration
def change
create_table :final_claim_cost_calculation_tables do |t|
t.integer :representative_number
t.string :policy_type
t.integer :policy_number
t.index [:policy_number, :representative_number], name: 'index_cl_pol_nu... |
Fabricator :setting do
name "setting_name"
content "Setting Content"
end
|
####
#
# Invoicing
#
# A batch of invoices to bill customers.
#
# The user searches for property-ids within a date range that will be billed.
# InvoicesMaker returns invoices that are to be debited during the invoicing
# period.
#
# An invoice is the information required to print an invoice. Made up of
# property rela... |
class TasksController < ApplicationController
before_action :set_task, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user, only: [:show, :edit, :update, :destroy]
def index
if params[:search].nil?
if params[:sort_priority].present?
@tasks = current_user.tas... |
require 'pessoa'
describe 'Atributos' do
before(:context) do
puts ">>>>>>>>>> ANTES de TODOS os testes"
end
after(:all) do
puts ">>>>>>>>>> DEPOIS de TODOS os testes"
end
# before(:each) do
# puts "ANTES"
# @pessoa = Pessoa.new
# end
# after(:each) do
# @pessoa.no... |
#to grab an API, follow the three steps below. NOTE: a KEY may be required. NEVER COMMIT code with the KEY!!!
require 'unirest'
response = Unirest.get("https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid%20in%20(select%20woeid%20from%20geo.places(1)%20where%20text%3D%22no... |
describe "Rspec Equality Matcher examples" do
context "To test different Rspec Equality Matchers" do
it "test eq matcher" do
a="Test String"
b=a
expect(a).to eq b
end
it "test eql matcher" do
a="Test String"
b=a
expect(a).to eql b
end
it "test 'be' matcher" do
a="Test String"
b=... |
class Api::GamesController < ApplicationController
def create
@game = Game.create!({player_id: (params[:playerId].to_i), score: 0})
@guesses = @game.create_5_rounds
@guesses.each_with_index do |guess, i|
guess.game_id = @game.id
guess.round_num = i + 1
guess.lat_guess = 0
... |
Pod::Spec.new do |s|
s.name = "Crashlytics"
s.authors = "Crashlytics"
s.summary = "Crashlytics Client Libraries"
s.version = "3.0.10"
s.homepage = "https://www.crashlytics.com/"
s.source = { :http => "http://repository.neonstingray.com/content/repositories/... |
class SearchTag < ActiveRecord::Base
attr_accessible :name
validates_uniqueness_of :name
def text
name
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.