text stringlengths 10 2.61M |
|---|
namespace :docs do
desc 'Builds index.md which links to other docs present in docs folder'
task :build do
files = Rake::FileList.new('docs/**/*.md') do |fl|
fl.exclude("~*")
fl.exclude("docs/index.md")
fl.exclude(/deprecated/)
end
message = "This file is auto generated please do not... |
require 'test_helper'
class ExternalValidationsTest < ActionDispatch::IntegrationTest
test "index should return json of all external validations" do
get '/external_validations.json'
assert_response 200
user_hash = { :name => "User", :validators => [
{ :class => "ActiveRecord::Validations::Presence... |
module ArtistsHelper
def link_to_detail_page label, target_object, target_attributes
if target_object == "artist_items"
link_to label, artist_item_path(*target_attributes)
elsif target_object == "artist_tracks"
link_to label, artist_track_path(*target_attributes)
end
end
def link_to_... |
class List < ActiveRecord::Base
belongs_to :user
has_many :list_movies
has_many :movies, through: :list_movies
def has_movie?(movie)
movies.include?(movie)
end
end
|
class CreateAmenities < ActiveRecord::Migration[5.0]
def change
create_table :amenities do |t|
t.belongs_to :property, index: true
t.boolean :kitchen
t.boolean :internet
t.boolean :heating
t.boolean :air_conditioning
t.boolean :washer_dryer
t.boolean :cable_tv
t.boo... |
module Constants
NUMBER_OF_POSSIBLE_JOKES = [5, 10, 20, 30]
end
|
class AddQToLineprs < ActiveRecord::Migration[5.0]
def change
rename_table :lineprs, :lnparams
add_column :lnparams, :ro, :float
add_column :lnparams, :k_scr, :float
add_column :lnparams, :k_tr, :float
add_column :lnparams, :k_peb, :float
add_column :lnparams, :q, :float
rename_column :lnp... |
class User < ApplicationRecord
before_create :confirmation_token
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# , :confirm... |
require 'pry-byebug'
=begin
Write a method that takes a year as input and returns the century. The return value should be a string that begins with the century number, and ends with st, nd, rd, or th as appropriate for that number.
New centuries begin in years that end with 01. So, the years 1901-2000 comprise the... |
require 'rails_helper'
RSpec.describe "Subject Resource", :type => :request do
describe "GET /subjects" do
it "returns subjects" do
get "/subjects"
expect(JSON.parse(response.body)).to eq({ "data" => [] })
end
end
describe "POST /subjects" do
it "creates subject, given valid parameters" do
... |
require 'active_support'
module ActiveRecordFlorder
# Base model implements all required logic
# It's depend on ActiveRecordFlorder::Configurable attributes
module Base
extend ActiveSupport::Concern
included do
# Include configuration methods
extend ActiveRecordFlorder::Configurable::Class... |
helpers do
def dev?; Sinatra::Application.environment.to_s == 'development'; end
def stage?; Sinatra::Application.environment.to_s == 'staging'; end
def test?; Sinatra::Application.environment.to_s == 'testing'; end
def scrape?; Sinatra::Application.environment.to_s == 'scraper'; end
def prod?; Sinatra::Appl... |
class PortfoliosController < ApplicationController
#
# 07/19/2017: Added functionality of filtering based on custom scope / query
#
def index
# @portfolioItems = Portfolio.prof
# @portfolioItems = Portfolio.proficiencies_scope
@portfolioItems = Portfolio.all
end
#
# 07/14/2017: Added functionality for New Record... |
require 'rails_helper'
describe "View stoplights", type: :request do
before do
create_list(:commuting_stop_event, 5)
end
it "returns 200" do
get("/api/v1/commuting/stoplights")
expect(response).to be_success
end
it "returns GeoJSON" do
get("/api/v1/commuting/stoplights")
json_body = JS... |
class StoresController < ApplicationController
layout 'application'
def index
@stores = Store.where(seller_id: session[:seller_id])
end
def show
@store = Store.find(params[:id])
end
def edit
@store = Store.find(params[:id])
end
def new
@store = Store.... |
class Item < ActiveRecord::Base
has_many :price_observations
def display_name
"#{name} - #{size}"
end
def average_price
price_observations.average(:price)
end
def maximum_price
price_observations.maximum(:price)
end
def minimum_price
price_observations.minimum(:price)
end
end
|
module CommaChameleon
class Railtie < ::Rails::Railtie #:nodoc:
initializer 'comma_chameleon' do |_app|
ActiveSupport.on_load(:active_record) do
require 'comma_chameleon/active_record_extension'
::ActiveRecord::Base.send :include,
CommaChameleon::ActiveRecordExtension
end
... |
# frozen_string_literal: true
require "spec_helper"
require "redis_test_helpers"
describe CmeFixListener::HistoryRequestRedisManager do
include RedisTestHelpers
describe ".pop_request_from_queue", redis: true do
let(:account1) { "300" }
let(:account2) { "301" }
before do
Resque.redis.rpush("cme... |
class SuppressionList
def SuppressionList.exists(email)
MGCLIENT.get("#{MAILGUN_DOMAIN}/bounces/#{email}")
true
rescue => e
false if /Address not found in bounces table/ =~ e.message
end
end
|
class CreateModels < ActiveRecord::Migration
def change
create_table :players do |t|
t.string :initials
end
create_table :games do |t|
t.integer :winner_id
t.integer :winner_time
t.timestamps
end
create_table :games_players do |t|
t.belongs_to :game
t.belongs... |
class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
add_flash_types :success, :info, :warning, :danger
protected
def configure_permitted_parameters
added_attrs = [:first_name, :last_name, :kana_first_name, :kana_last_name, :email, :ph... |
require 'spec_helper'
describe SessionsController do
describe 'GET new' do
it 'renders the new template for unauthenticated users' do
get :new
expect(response).to render_template :new
end
it 'redirects to home page if logged in' do
set_current_user
get :new
expect(response)... |
module Fog
module Network
class AzureRM
# This class is giving implementation of all/list, get and
# check name availability for virtual network.
class VirtualNetworks < Fog::Collection
model Fog::Network::AzureRM::VirtualNetwork
attribute :resource_group
def all
... |
# -*- coding: utf-8 -*-
require 'diva'
Retriever = Diva
module Diva
# _model_slug_ をslugとして持つModelクラスを返す。
# 見つからない場合、nilを返す。
def self.Model(model_slug)
model_dict[model_slug.to_sym]
end
# _uri_ を Diva::URI に変換する。
# _uri_ が既に Diva::URI のインスタンスだった場合は _uri_ を返すので、Diva::URI
# かもしれないオブジェクトを Diva::URI に変... |
class Client
def initialize()
@config = YAML::load_file(Dir.pwd + '/config/config.yaml')
@github = Github.new(@config['github']['username'],@config['github']['password']);
Broach.settings = { 'account' => @config['campfire']['account'],
'token' => @config['campfire']['token'],
'use_ssl' => true
... |
feature "Switch Organisation" do
include_context "admin"
it "has the expected content" do
click_link "Switch organisation"
expect(page).to have_xpath "//h1[text()='Switch organisation']"
end
it "switches location" do
click_link "Switch organisation"
click_button "Automated Test 2"
expect... |
##
#
#
#
module Tessera
module Api
class TicketCreate
def initialize(body_content)
@body = body.merge(body_content)
end
def self.call(body_content)
new(body_content).call
end
def call
response = Tessera::Request.new(:POST, 'Ticket', @body).send
JSON.... |
class Patient < ActiveRecord::Base
attr_accessor :login
has_one :pathway, dependent: :destroy
has_and_belongs_to_many :teams
has_many :doctors, through: :teams
has_many :treatment_states, through: :pathway
has_many :treatment_modules, through: :treatment_states
after_save :create_pathway
# Include d... |
class ApplicationController < ActionController::Base
helper_method :minimum_layout?, :minimum_layout!
# TODO これってprivateでもいいのかも?
def after_sign_in_path_for(resource)
if user_signed_in?
flash[:notice] = 'ログインしました。'
root_path
else
home_sign_up_done_path
end
end
private
def min... |
class UserServicesMailer < ActionMailer::Base
# Use application_mail.html.erb
layout 'application_mailer'
# Automatically inject css styles
include Roadie::Rails::Automatic
include Rails.application.routes.url_helpers
default from: "Lendojo <staff@lendojo.com>"
# Mail when a user service 'check' status is ... |
class ScreenWriter::SessionsController < Devise::SessionsController
# before_filter :configure_sign_in_params, only: [:create]
# GET /resource/sign_in
def new
super
end
# POST /resource/sign_in
def create
super_class = super
email = params[:screen_writer][:email]
user = ScreenWriter.find_by_em... |
class Profile < ApplicationRecord
belongs_to :user
has_many :shootings, :through => :user
mount_uploader :avatar, AvatarUploader
end
|
# -*- encoding : utf-8 -*-
require 'helper'
class RedisModelAutoincrementTest < Test::Unit::TestCase
context "Autoincrement" do
setup do
RedisModelExtension::Database.redis.flushdb
@args = {
name: "Author",
email: "ondrej@bartas.cz"
}
end
context "without redis_key spec... |
BogApp::Application.routes.draw do
root to: 'bogs#index'
get '/bogs', to: 'bogs#index' #/bogs is the menu page
get '/bogs/new', to: 'bogs#new' #new goes to /bogs/:id then to /show
get '/bogs/list', to: 'bogs#list' # list is an index (has to go before show)
get '/bogs/:id', to: 'bogs#show' #1 i... |
json.array!(@addresses) do |address|
json.extract! address, :id, :line_one, :line_two, :line_three, :city, :zipcode
json.url address_url(address, format: :json)
end
|
require 'spec_helper'
describe Cratus::Group do
subject do
Cratus::Group
end
let(:search_filter) { /^\(cn=\w+\)$/ }
let(:memberof_search_filter) { '(cn=test1)' }
let(:search_filter2) { '(cn=test2)' }
let(:find_all_filter) { '(cn=*)' }
let(:fake_user) do
instance_double(
'Cratus::User',... |
class LoginPage < SitePrism::Page
element :campo_email, 'input[name=email]'
element :campo_senha, 'input[title$=password]'
element :botao_entrar, 'button[id*=btnLogin]'
element :alerta_login, ".alert-login"
def logar(email,senha)
campo_email.set email
campo_senha.set senha
... |
class Users::MypagesController < ApplicationController
before_action :authenticate_user!, except: :index
before_action :redirect_mypage, except: :index
def index
end
def show
@user = User.find(params[:id])
end
def password
end
def edit
@user = User.find(params[:id])
end
def confirm
... |
require 'rest_client'
require 'json'
require 'uri'
module Twigg
module Pivotal
class Resource
class << self
private
PIVOTAL_BASE = 'https://www.pivotaltracker.com/services/v5'
def get(resource, paginate: true, **params)
results = []
offset = paginate ? 0 : nil
... |
# input: integer
# output: if argument is double number, leave as is
# if not double number, times by 2
# double number - even number of digits (left side digits same as right side)
# if the number of digits is odd then times by 2
# data structure: array
# algo:
# first check if the argument has odd number of integers,... |
require 'test/unit'
require '../../lib/global/globalDef'
module Jabverwock
using StringExtension
using ArrayExtension
using SymbolExtension
class GlobaDefTest < Test::Unit::TestCase
class << self
# テスト群の実行前に呼ばれる.変な初期化トリックがいらなくなる
def startup
p :_startup
end
# テスト群の実行後に呼... |
Rails.application.routes.draw do
devise_for :users, :controllers => { registrations: 'registrations'}
resources :categories, only: [:show]
namespace :admin do
resources :categories do
resources :sub_categories
end
end
root 'static_pages#index'
get 'contact' => 'static_pages#contact'
get 'a... |
require 'spec_helper'
describe "Phrase" do
before :each do
@first_phrase = Phrase.create!(key: "Hey there, sassy pants.")
@second_phrase = Phrase.create!(key: "I'm a very eloquent phrase")
@third_phrase = Phrase.create!(key: "You wish you were...")
@best_translation = @first_phrase.translations.cr... |
class RightsDeclaration < ApplicationRecord
belongs_to :rights_declarable, polymorphic: true, touch: true
before_validation :set_defaults
before_validation :maybe_clear_custom_copyright
cattr_accessor :rights_bases, :default_rights_basis, :copyright_jurisdictions, :default_copyright_jurisdiction,
... |
require 'spec_helper'
describe 'os_transport_url' do
it 'refuses String' do
is_expected.to run.with_params('foo').\
and_raise_error(Puppet::ParseError, /Requires an hash/)
end
it 'refuses Array' do
is_expected.to run.with_params(['foo']).\
and_raise_error(Puppet::ParseError, /Requires an ha... |
module BoatOwner
extend ActiveSupport::Concern
included do
has_many :boats, inverse_of: self.name.underscore, dependent: :restrict_with_error
before_destroy :ensure_no_boat_dependencies
end
private
def ensure_no_boat_dependencies
if Boat.where("#{self.class.name.underscore}_id = ?", id).exists... |
class WineVarietiesController < ApplicationController
before_action :authenticate_user!
before_action :set_wine_variety, only: [:show, :edit, :update, :destroy]
# GET /wine_varieties
# GET /wine_varieties.json
def index
@wine_varieties = WineVariety.all
end
# GET /wine_varieties/1
# GET /wine_var... |
# == Schema Information
#
# Table name: admins
#
# id :bigint(8) not null, primary key
# user_id :integer
# business_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class Admin < ApplicationRecord
belongs_to :user
belongs_to :business
valid... |
require 'set'
module Loofah
module Elements
# Block elements in HTML4
STRICT_BLOCK_LEVEL = Set.new %w[address blockquote center dir div dl
fieldset form h1 h2 h3 h4 h5 h6 hr isindex menu noframes
noscript ol p pre table ul]
# The following elements may also be considered block-level elements... |
class Item < ActiveRecord::Base
has_and_belongs_to_many :tags
has_many :users
has_many :potlucks
end |
require 'spec_helper'
describe 'ApplicationController' do
describe "GET '/'" do
it "returns a 200 status code" do
get '/'
expect(last_response.status).to eq(200)
end
it "contains a form for a user to log in" do
get '/'
expect(last_response.body).to include("<input")
end
end... |
# frozen_string_literal: true
require 'rails_helper'
describe 'Chat', type: :system do
shared_examples "Chat" do |framework|
context "#{framework} version" do
let!(:user) { create(:user, nickname: 'person1') }
let!(:another_user) { create(:user, nickname: 'person2') }
it 'allows live messagin... |
require_relative 'lexicons_cache'
require_relative 'lexicon_map'
require_relative '../kaf/document'
module Opener
class PolarityTagger
class Internal
DESC = 'VUA polarity tagger multilanguage'
LAST_EDITED = '21may2014'
VERSION = '1.2'
N_WORDS = 5
CACHE = Lexic... |
module ArRedis
class Base
attr_reader :key, :redis_client
def initialize(key)
@key = key.to_s
@redis_client = ArRedis.redis
end
def [](next_key)
ArRedis::Base.new("#{key}:#{next_key}")
end
def call(command, *arguments)
redis_client.call(command, key, *arguments)
... |
require 'image_size'
require 'open-uri'
class Thumbnail
def initialize(asset, key)
@asset = asset
@key = key
end
def create
@asset.thumb('300x').encode('jpg', '-quality 90')
end
def thumbnail_filename
Digest::SHA1.hexdigest(@key)
end
def thumbnail_path
File.join("thumbnails", thumb... |
class Luhn
attr_reader :name, :amount, :cards_array
def initialize(name)
@name = name
end
# this method is not currently useful, as I need to review the RSpec docs about printing something to the console and storing the response from the user.
def set_amount_of_cards(amount)
@amount = 0
case
... |
require 'nokogiri'
class LoadCampgroundData
TYPES = {
"NF" => "National Forest",
"CP" => "City/County/Regional",
"SP" => "State Park",
"COE" => "Army Engineers",
"OS" => "Other State (Forest/Wildlife)",
"OF" => "Other Federal (Reclamation, TVA, Military)",
"NP" => "National Park (Monumen... |
class Dog < ApplicationRecord
has_many :employees
def employee_count
employees.count
end
def self.sorted_dogs
Dog.all.sort_by {|dog| dog.employee_count}
end
end
|
class RemovePersonTypeIdFromPeople < ActiveRecord::Migration
def change
remove_column :people, :person_type_id, :references
end
end
|
FactoryBot.define do
factory :company do
name { Faker::Name.first_name }
balance_cents { Random.rand(1000..100000) }
status { %w[Active Pending].sample }
end
end
|
#
# Author:: Stephen Delano
# Copyright:: Copyright (c) 2012 Opscode, Inc.
# License:: Apache License, Version 2.0
#
# 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 Proposal < ApplicationRecord
belongs_to :mittente, :class_name => 'User'
belongs_to :libromittente, :class_name => 'ProposedBook'
belongs_to :destinatario, :class_name => 'User'
belongs_to :librodestinatario, :class_name => 'ProposedBook'
validates :mittente, :destinatario, :libromittente, :librodestina... |
module Api
module V1
class MoviesController < ApplicationController
MissingParams = Class.new(StandardError)
around_action :skip_bullet, only: %i[index]
before_action :set_movie, only: %i[show update destroy]
def index
movies = ::Movies::UseCases::Index.new(params: params).call
... |
class User < ActiveRecord::Base
def self.find_or_create_from_oauth(oauth)
user = User.find_or_create_by(provider: oauth.provider, uid: oauth.uid)
user.email = oauth.info.email
user.nickname = oauth.info.nickname
user.image_url = oauth.info.image
user.token = oauth.credentials.token
us... |
require File.dirname(__FILE__) + '/../spec_helper'
# Ugh. This is my first attempt a rspec and I don't grok it yet. Flame me not --KML
describe "Product without min price", :shared => true do
before(:each) do
@product = Product.new
end
it "should have nil min_price" do
@product.min_price.... |
# vi: set fileencoding=utf-8 :
module UserHelper
#
# 注册接口
#
def register
username = params[:username]
password = params[:password]
code, user = User.register(username, password, self)
if code == ResultCode::OK
return render_result(code, user.to_dictionary)
end
return render_result... |
module Twilio
class SendTextService
def self.build(to_number,from_number,message)
self.new(to_number,from_number,message)
end
def initialize(to_number,from_number,message)
@to_number = to_number
@from_number = from_number
@message = message
end
def call
Rails.logger... |
require 'rails_helper'
RSpec.describe EventManagement::Nightclub, type: :model do
describe ".create!" do
subject { EventManagement::Nightclub.create!(args) }
let!(:args) do
{
name: "test club"
}
end
context "with valid args" do
specify do
expect(Nightclub.count).t... |
# == Schema Information
#
# Table name: all_jokes
#
# id :bigint(8) not null, primary key
# joke :string
# joke_type :integer
# sequence :integer
# uuid :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class AllJoke < ApplicationRecord
ha... |
require 'spec_helper'
describe "Posts Routes" do
get('/').should route_to(
:controller => 'posts',
:action => 'index'
)
get("/4").should route_to(
:controller => 'posts',
:action => 'redirect_to_right_path',
:id => '4'
)
get("/4-testando-post").should route_to(
:controller => 'post... |
FactoryGirl.define do
factory :team do
name { "#{Faker::Name.name} Team" }
end
end
|
require "spec_helper"
describe CucumberBoosterConfig::Injection do
context "when the project has no cucumber configuration" do
before do
expect(File.exists?("cucumber.yml")).to be(false)
CucumberBoosterConfig::Injection.new(".", "/tmp/report_path.json").run
end
it "creates a new cucumber.y... |
class AdInfo < ActiveRecord::Base
has_many :search_info_ads_relations
has_many :search_infos, through: :search_info_ads_relations
belongs_to :search_info
end
|
# frozen_string_literal: true
class PlanDisplay < EffortWithLapSplitRows
include TimeFormats
attr_reader :course
delegate :simple?, :name, to: :course
delegate :multiple_laps?, :organization, to: :event
def initialize(args)
@course = args[:course]
@params = args[:params]
@effort = event.efforts.... |
class Event < ApplicationRecord
belongs_to :host, class_name: :User, foreign_key: "user_id"
belongs_to :game
has_many :attendances, dependent: :delete_all
has_many :attendees, through: :attendances, source: :user
end
|
module Types
class QueryType < Types::BaseObject
# Add root-level fields here.
# They will be entry points for queries on your schema.
field :interest, !types[Types::InterestType] do
resolve -> (obj, args, ctx) {
Interest.all
}
end
end
end
|
class CreateMessages < ActiveRecord::Migration
def self.up
create_table :messages do |t|
t.text :body
t.boolean :train
t.integer :address_id
t.integer :category_id
t.integer :subject_id
t.string :assigned_category
t.integer :user_id
t.timestamps
end
add_ind... |
class Beer < ApplicationRecord
belongs_to :brewery
before_save :custom_before_save
validates(
:name,
presence: true,
uniqueness: {
case_sensitive: false,
scope: [:brewery_id],
}
)
validates :style, presence: true
validates(
:ibu,
presence: true,
numericality: true,
... |
Kaigara::Metadata.new do |v|
v.source_url = 'https://github.com/ryanmjacobs/darkhttpd'
v.srv.document_root = '/home/web/public'
v.srv.access_log = '/home/web/log'
v.srv.uid = 'web'
v.srv.gid = 'users'
end
|
RSpec.describe TickTock do
it "has a version number" do
expect(TickTock::VERSION).not_to be nil
end
end
|
#!/usr/bin/ruby -w
# ALBUM
# Copyright Mark Keane, All Rights Reserved, 2014
# Class that encodes details of an album.
class Album
attr_accessor :name, :tracks, :length, :artist, :owners, :id
def initialize(name, tracks, length, artist, owners) # create an object
@name = name
@tracks = tracks
@length =... |
# frozen_string_literal: true
# xkcd.rb
# Author: William Woodruff
# ------------------------
# A Cinch plugin that provides New Yorker cartoons for yossarian-bot.
# ------------------------
# This code is licensed by William Woodruff under the MIT License.
# http://opensource.org/licenses/MIT
require "htmlent... |
module HandFinder
def find_high(cards)
sort(cards).first
end
def find_pair(cards)
metrics = build_face_metric(cards)
face = metrics.key(4) || metrics.key(3) || metrics.key(2)
return nil unless face
(cards.select {|card| card.face == face}).take(2)
end
def find_two_pairs(cards)
first_... |
module Amazon
module FPS
class Widget
@@app_name = "ASP"
@@http_method = "POST"
@@service_end_point = "https://authorize.payments-sandbox.amazon.com/pba/paypipeline"
@@access_key = "<Paste your access key id here>"
@@secret_key = "<Paste your secret key here>"
def self.get_pa... |
require "spec_helper"
feature "User registers", js: true, vcr: true do
background do
visit register_path
end
scenario "with valid user info and credit card" do
enter_valid_user_info
enter_valid_credit_card
click_button "Sign Up"
sleep(1)
expect(page).to have_content("You are registered w... |
# encoding: UTF-8
class Film
class RelationPersonnage
# Propriétés supplémentaires pour une relation de personnages
# {Array d'identifiant} Liste des personnages en relation
# dans cette relations
attr_reader :personnages_ids
end #/RelationPersonnage
end #/Film
|
class AnimalInfo::Controller
attr_reader :animal_name
def initialize(animal_name)
@animal_name = animal_name
display_information
end
def display_information
puts "Please wait while we fetch info for you!"
begin
animal = AnimalInfo::Animal.new_from_wikipedia(@animal_name)
if animal.... |
# frozen_string_literal: true
require 'rib/more/multiline_history'
module Rib; module MultilineHistoryFile
extend Plugin
Shell.use(self)
# --------------- Rib API ---------------
def before_loop
return super if MultilineHistoryFile.disabled?
multiline_history_file_token
super
end
# --------... |
require 'rails_helper'
RSpec.describe TeamsController, type: :controller do
describe '/team ' do
before(:each) do
create_list(:team, 5)
get :index, format: :json
@body = JSON.parse(response.body)
end
it 'returns a successful 200 response' do
expect(response).to be_success
end... |
require_relative 'api_spec_helper'
module DiceOfDebt
describe API do
include_context 'api test'
subject { last_response }
let(:game1) { { games: { id: '1' } } }
let(:roll) { { type: 'roll' } }
before { allow(RandomRoller).to receive(:roll) { 6 } }
def post_roll(data = nil, game_id = 1)
... |
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'As a visitor' do
describe 'When I visit a pet show page I see a link to view all applications for that pet' do
before(:each) do
@application1 = Application.create(name: 'Mary Margret',
address: '... |
require 'spec_helper'
describe Visualization::BoxplotPresenter, :type => :view do
before(:each) do
@visualization_data = FactoryGirl.build(:visualization_boxplot)
@visualization_data.rows = [
{:bucket => "apple", :min => 0.0, :median => 0.5, :max => 1.0, :first_quartile => 0.25, :third_quartile => 0.... |
module Rpodder
class ListPodcasts < Base
def initialize
super
get_podcasts
format_podcasts
end
def get_podcasts
@podcasts ||= Podcast.all
if @podcasts.count == 0
error 'No podcasts found'
exit 1
end
end
def format_podcasts
rows = []
... |
class Planet < ApplicationRecord
has_many :residents, class_name: "Person", inverse_of: :homeworld, dependent: :nullify
validates :name, uniqueness: true
end
|
module MiqOpenStackCommon
def disk_format_glance_v1(snapshot_image_id)
image_service.get_image(snapshot_image_id).headers['X-Image-Meta-Disk_format']
end
def disk_format_glance_v2(snapshot_image_id)
image_service.images.get(snapshot_image_id).disk_format
end
def disk_format(snapshot_image_id)
se... |
class CreateRetailers < ActiveRecord::Migration
def change
create_table :retailers do |t|
t.string :retailer_name
t.string :retailer_address
t.string :retailer_street_name
t.string :retailer_city
t.string :retailer_state
t.string :retailer_website
t.string :retailer_phone... |
require 'nokogiri'
class Premiere
CSS_QUERY_FOR_SECOND_ARTICLES = ".titres_hauts"
attr_reader :couverture, :secondary_articles
Couverture = Struct.new(:title, :image, :desc, :link, :links)
Link = Struct.new(:text, :link)
def initialize(couverture, secondary_articles)
@couverture = couverture
@s... |
module DataModules::FeNavigation
class FeNavigationItem < ApplicationRecord
include Jsonable
include DataPlugins::Facet::Concerns::ActsAsFacetItem
include Translatable
include FapiCacheable
# ASSOCIATIONS
belongs_to :navigation, class_name: DataModules::FeNavigation::FeNavigation
belongs_... |
# frozen_string_literal: true
require 'rails_helper'
require "#{Rails.root}/lib/importers/plagiabot_importer"
describe PlagiabotImporter do
describe '.check_recent_revisions' do
it 'should save ithenticate_id for recent suspect revisions' do
# This is a revision in the plagiabot database, although the date... |
class PurchaseFormTests < Test::Unit::TestCase
def setup
@selenium = SeleniumWrapper.new
end
def teardown
@selenium.quit
end
def test_fillout_purchase_form
@selenium.get(TestData.get_base_url + "/purchase-forms/3rd-party-links")
@selenium.type_text(TestData.get_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.