text stringlengths 10 2.61M |
|---|
module TacticCommandModule
@template = {}
Index = {
:basic => [
# category #condition # args # action # args
[:targeting, :nearest_visible, [true], :set_target, [nil] ],
[:fighting, :any, [true], :attack_mainhoof, [nil] ],
]
}
... |
require 'rails_helper'
describe SessionsController do
describe "GET#{}new" do
it "renders the :new template" do
get :new
expect(response).to render_template :new
end
end
describe "POST#create" do
before :each do
@user = create(:user, username:'user1', password: 'oldpassword', pass... |
FactoryGirl.define do
factory :user, class: User do
email "user@example.com"
password "password"
factory :new_user, class: User do
password_confirmation "password"
end
end
factory :edit_user, class: User do
email "edit_user@example.com"
password "12345678"
password_confirmation... |
class MigrateAccountSourceId < ActiveRecord::Migration
def change
Account.find_each do |account|
unless account.source_id.nil?
source = Source.where(id: account.source_id).last
unless source.nil?
account.sources << source
end
end
end
remove_column :accounts, :... |
module Rack
module OAuth2
class Server
# Authorization request. Represents request on behalf of client to access
# particular scope. Use this to keep state from incoming authorization
# request to grant/deny redirect.
class AuthRequest < ActiveRecord::Base
belongs_to :client, :cla... |
require 'rails_helper'
RSpec.describe TwitterService, type: :model do
describe '.get_data' do
context 'with a valid hashtag' do
it 'should return not raise an error' do
expect{TwitterService.get_data('MUFC')}.to_not raise_error
end
end
end
end |
RSpec.describe Api::V0x0::ContainerProjectsController, type: :controller do
let(:source) { Source.create!(:tenant => tenant) }
let(:tenant) { Tenant.create! }
it "get /container_projects lists all Container Projects" do
project = ContainerProject.create!(:tenant => tenant, :source => source, :name => "test_c... |
class Follow < ActiveRecord::Base
belongs_to :user#一个人关注很多商品
belongs_to :commidity #一件商品被很多人关注
validates :follower_id,presence:true
validates :commodity_id,presence:true
end
|
# Class representing an lti advantage launch inside a controller
#
# When a controller includes the `lti_support` concern, an
# instance of this class will be accessible from the 'lti' property.
module LtiAdvantage
class LtiAdvantage::Request
attr_reader :lti_token, :lti_params
# delegate all other methods... |
# Storage for the user's original names and converted results.
$originalNames = [ ]
$convertedNames = [ ]
def nameconvert (inputname)
vowels = "aeiou"
consonants = 'bcdfghjklmnpqrstvwxyz'
# Cycles through each letter in input.
for i in 0...inputname.length
# If character in question is a consonant,
# co... |
require 'octokit'
require './lib/parsers'
module Wrappers
module Github
include Parsers
OCTOKIT = Octokit::Client.new(access_token: ENV['ACCESS_TOKEN'])
def commit_message(repo, sha)
OCTOKIT.commit(repo, sha).commit.message
end
def pr_body(repo, number)
OCTOKIT.pull_request(repo, n... |
class CreateRelations < ActiveRecord::Migration
def change
create_table :relations do |t|
t.references :user, index: true
t.integer :followed_id, index: true
t.timestamps null: false
end
add_foreign_key :relations, :users
add_foreign_key :relations, :users, column: :followed_id, pri... |
require 'rails_helper'
describe User do
describe '#create' do
it "項目がすべて存在すれば登録できること" do
user = build(:user)
expect(user).to be_valid
end
it "nicknameがない場合は登録できないこと" do
user = build(:user, nickname: nil)
user.valid?
expect(user.errors[:nickname]).to include("を入力してください")
... |
# frozen_string_literal: true
# can move diagonal
class Bishop < Piece
BEHAVIORS = [
{
start_condition: 'none',
directions: %w[top_right top_left bottom_right bottom_left],
take_opponent: true
}
].freeze
def behaviors
BEHAVIORS
end
def to_s
ColorizedString["\s♗\s"].coloriz... |
class FixQuestionsColumnName < ActiveRecord::Migration[5.0]
def change
remove_column :questions,:questions_additional_text
change_table :questions do |t|
t.column :question_additional_text, :string
end
end
end
|
class UserstatsController < ApplicationController
before_filter :user_signed_in, :except => []
def index
@userstats = Userstat.all
end
def new
@userstat = Userstat.new
end
def create
@userstat = Userstat.new(params[:userstat])
if @userstat.save
flash[:notice] = "Userstat has been created."
... |
class Backer
attr_accessor :name, :backed_projects
def initialize(name)
@name = name
@backed_projects = []
end
def back_project(project)
@backed_projects << project
project.backers << self
end
end
# When a backer has added a project to it's list of backed projects, that project should also add the backer... |
require_relative 'tmux/config'
require_relative 'tmux/interface'
require_relative 'tmux/session'
require_relative 'tmux/plugins'
module Lab42
module Tmux
def config &block
$config = Config.new
$config.instance_exec( &block )
end
def new_session session_name=nil, &block
raise ArgumentE... |
class Fluentd::Settings::RunningBackupController < ApplicationController
include SettingHistoryConcern
private
def find_backup_file
@backup_file = Fluentd::SettingArchive::BackupFile.new(@fluentd.agent.running_config_backup_file)
end
end
|
class Participation < ActiveRecord::Base
belongs_to :user
belongs_to :project
enum status: [:doing, :quited, :arrived, :finished]
end |
require 'spec_helper'
require 'bakery_app'
describe BakeryApp do
describe "#run" do
before(:each) do
allow(STDOUT).to receive(:puts)
end
it "returns if there is odd number of input params" do
inputs = (['input'] * (rand(3) * 2 + 1)).join(' ')
allow(STDIN).to receive_message_chain(:gets... |
require 'rails_helper'
describe "Destinations API" do
it "sends a list of destinations" do
Fabricate.times(3, :destination)
get '/api/v1/destinations'
expect(response).to be_success
destinations = JSON.parse(response.body)
expect(destinations.count).to eq(3)
end
it "sends a single destin... |
# frozen_string_literal: true
require "net/http"
require "zlib"
module Sentry
class HTTPTransport < Transport
GZIP_ENCODING = "gzip"
GZIP_THRESHOLD = 1024 * 30
CONTENT_TYPE = 'application/x-sentry-envelope'
DEFAULT_DELAY = 60
RETRY_AFTER_HEADER = "retry-after"
RATE_LIMIT_HEADER = "x-sentry-... |
class TicketMailer < ActionMailer::Base
default from: 'tinam03@yahoo.com'
# Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.ticket_mailer.issue_confirmation.subject
#
def issue_confirmation(ticket)
mail to: ENV["EMAIL"], subject: "You've got mail."... |
class User < ApplicationRecord
has_many :friendships
has_many :friends, :through => :friendships
has_many :inverse_friendships, :class_name => "Friendship", :foreign_key => "friend_id"
has_many :followed_by_users, :through => :inverse_friendships, :source => :user
end
|
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe Tournament, type: :model do
it 'has valid factory' do
expect(create(:tournament)).to be_valid
end
end
|
require 'aurora/config'
describe Aurora::Config do
describe "#set_attributes_from_hash" do
let(:config_attrs) do
{
:aurora_admin_user => 'bliu@pivotallabs.com',
:target_rb_name => 'RB',
:aurora_initialized => true,
:aurora_service_url => 'https://10.80.129.96/datadir... |
desc "Import the local address xls file"
task :import_local_addresses => :environment do
require 'parseexcel/parser'
# XXX KML TODO get the file name in a better fashion
file = './tmp/local data.xls'
workbook = Spreadsheet::ParseExcel::Parser.new.parse file
worksheet = workbook.worksheet 0
cat_... |
class UsersController < ApplicationController
skip_before_action :authorized, only: [:create]
# def profile
# render json: { user: UserSerializer.new(current_user) },
# status: :accepted
# end
def create
user = User.create(user_params)
if user.valid?
token = encode_token({ user_id: user.id })
... |
class RentalsController < ApplicationController
def checkout
new_rental = Rental.new(rentals_params)
new_rental.checkout_date = Date.today
new_rental.due_date = Date.today + 7.days
new_rental.return_date = nil
if new_rental.customer.nil? || new_rental.video.nil?
render json: {
erro... |
require_relative '../test_helper'
class ElasticSearch9Test < ActionController::TestCase
def setup
super
setup_elasticsearch
end
test "should filter items by has_claim" do
t = create_team
p = create_project team: t
u = create_user
create_team_user team: t, user: u, role: 'admin'
with_... |
class Webhook < ActiveRecord::Base
has_many :attempts
belongs_to :consumer
delegate :producer, :to => :consumer, allow_nil: false
after_initialize :assign_defaults, if: 'new_record?'
scope :failed, where(failed: true)
scope :attempt, where(attempt: true)
validates_presence_of :post_data
validates_pre... |
class CreateUserProfiles < ActiveRecord::Migration[5.1]
def change
create_table :user_profiles do |t|
t.belongs_to :user, index: true, foreign_key: true, null: false
t.attachment :profile_picture
t.string :address
t.string :brand
t.string :business_owner
t.string :representativ... |
# == Schema Information
#
# Table name: results
#
# id :integer not null, primary key
# sets :string default([]), is an Array
# match_id :integer
# created_at :datetime not null
# updated_at :datetime not null
#
class Result < ApplicationRecord
belongs_to :matc... |
class AddFeedItemCreatorId < ActiveRecord::Migration
def self.up
add_column :feed_items, :creator_id, :integer
end
def self.down
remove_column :feed_items, :creator_id
end
end
|
# -*- coding: utf-8 -*-
require 'mui/cairo_miracle_painter'
require 'gtk2'
module Gtk
class CellRendererMessage < CellRendererPixbuf
type_register
install_property(GLib::Param::String.new("uri", "uri", "Resource URI", "hoge", GLib::Param::READABLE|GLib::Param::WRITABLE))
attr_reader :message
def ... |
# describe "Class" do
# it "should have an attr_accessor_with_history method" do
# lambda { Class.new.attr_accessor_with_history }.should_not raise_error(::NoMethodError)
# end
# end
class Class
def attr_accessor_with_history(attr_name)
attr_name = attr_name.to_s # make sure it's a string
attr_reade... |
# encoding: utf-8
Given(/^I visit login page$/) do
login.load
end
Given(/^I'm on login page$/) do
expect(page).to have_current_path('/login')
end
When(/^I try to login with user "([^"]*)" and password "([^"]*)"$/) do |username, password|
login.loginIn(username, password)
end
Then(/^I can s... |
source 'https://rubygems.org'
ruby '2.3.0'
gem 'rails', '>= 5.0.0.beta3', '< 5.1'
gem 'puma', '~> 3.1'
gem 'secure_headers', '~> 3.0'
gem 'pg', '~> 0.18.4'
gem 'active_model_serializers', '~> 0.10.0.rc4'
gem 'rack-cors', '~> 0.4.0'
gem 'bcrypt', ... |
module PasswordResettable
extend ActiveSupport::Concern
included do
validates :password_reset_token, :uniqueness => true, :allow_nil => true
before_save :unset_password_reset_token
end
def send_password_reset_instructions
set_password_reset_token
PasswordResetMailer.send_reset_instructions(sel... |
productos = [
'acai',
'ackee',
'apple',
'apricot',
'avocado',
'banana',
'bilberry',
'blackberry',
'blackcurrant',
'black',
'blueberry',
'boysenberry',
'breadfruit',
'buddha',
'cactus',
'crab',
'currant',
'cherry',
'cherimoya',
'chico',
... |
class Amount
attr_reader :value
def initialize(value)
@value = Integer(value)
end
def sum(a)
self.new(a.value + self.value)
end
def sub(a)
self.new(a.value - self.value)
end
end |
class Restaurant < ApplicationRecord
belongs_to :cuisine
has_many :reviews
has_one :restaurant_reviews_metadatum
after_create :create_restaurant_metadata
validates :name, :address, :delivery_sla_in_minutes, :longitude, :latitude, presence: true
validates :does_accept_10bis, inclusion: { in: [true, false] }... |
require 'fileutils'
class Hakiri::Manifest < Hakiri::Cli
#
# Generates a JSON manifest file
#
def generate
FileUtils::copy_file "#{File.dirname(__FILE__)}/manifest.json", "#{Dir.pwd}/manifest.json"
File.chmod 0755, "#{Dir.pwd}/manifest.json"
say '-----> Generating a manifest file...'
say " ... |
class AddMissingColumnsToFields < ActiveRecord::Migration[5.2]
def change
add_column :fields, :validation_type, :string
add_column :fields, :description, :text
end
end
|
require 'gosu_android/input/buttons'
module Gosu
class Button
attr_reader :id
def initialize(*args)
case args.length
when 0
@id = NoButton
when 1
@id = args[0]
else
raise ArgumentError
end
end
# Tests whether two Buttons identify the same physica... |
class StreetSwarm < ApplicationRecord
belongs_to :user
belongs_to :chapter
has_one :address, through: :chapter
scope :with_addresses, -> { includes(:address) }
def self.options
['Street Swarms']
end
validates :user, :chapter, presence: true
validates :mobilizers_attended,
numericalit... |
# frozen_string_literal: true
require "spec_helper"
describe Decidim::Participations::FilteredParticipations do
let(:organization) { create(:organization) }
let(:participatory_process) { create(:participatory_process, organization: organization) }
let(:feature) { create(:participation_feature, participatory_spa... |
class PostedProjectSerializer < ActiveModel::Serializer
attributes :id, :student_id, :project_id
end
|
class LastfmWrapper::Artist < LastfmWrapper::Base
SEARCH_LIMIT = 10
def self.info keyword, opts = {}
opts.merge! :artist => keyword, :autocorrect => 1, :lang => 'jp'
result = self.api.artist.get_info opts
if result.blank?
return nil
end
main_image = nil
thumbnail_image = nil
res... |
class AddCachedAnnotationsCountToProjectMedia < ActiveRecord::Migration
def change
add_column :project_medias, :cached_annotations_count, :integer, default: 0
end
end
|
Pod::Spec.new do |s|
s.name = 'RaptureXML'
s.version = '1.0.1'
s.source = { :http => 'http://repository.neonstingray.com/content/repositories/thirdparty/com/rapturexml/ios/rapturexml/1.0.1/rapturexml-1.0.1.zip' }
s.platform = :ios
s.source_files = 'RaptureXML/**/*'
s... |
class Topic < ApplicationRecord
validates :name, presence: true, length: {minimum: 5}
validates :description, presence: true, length: {maximum: 250}
mount_uploader :picture, PictureUploader
# Validates the size of and Uploaded image
def picture_size
if picture.size > 5.megabytes
errors.add(:pi... |
class AddFriendlyIdToDeliveryRequests < ActiveRecord::Migration
def change
if Rails.env.test?
add_column :delivery_requests, :slug, :string
else
add_column :delivery_requests, :slug, :string, null: false
end
DeliveryRequest.find_each(&:save)
# add_column :delivery_requests, :url_hash, :... |
module EsClient
class Client
RETRY_TIMES = 1
HTTP_VERBS = %i(get post put delete head)
SUCCESS_HTTP_CODES = [200, 201]
def initialize(host, options)
@host = host
@options = options
end
HTTP_VERBS.each do |method|
class_eval <<-DEF, __FILE__, __LINE__ + 1
def #{met... |
class CreatePeppers < ActiveRecord::Migration[5.2]
def change
rename_table :tomatoes, :plants
add_column :plants, :type, :string
end
end
|
# Borrowed from https://github.com/yui-knk/mruby-set
class Set
include Enumerable
def self.[](*ary)
new(ary)
end
def initialize(enum = nil, &block)
@hash ||= Hash.new
enum.nil? and return
if block_given?
do_with_enum(enum) { |o| add(block.call(o)) }
else
merge(enum)
end
... |
class AuthorsController < ApplicationController
def show
@author = Author.find(params[:id])
end
def new
end
def create
@author = Author.new(author_params)
respond_to do |format|
if @author.save
format.html { redirect_to author_path(@author), notice: 'Author Successfully created.' ... |
require 'resourceful'
require 'dm-core/adapters/abstract_adapter'
module DataMapper::Adapters
class AbstractRestAdapter < AbstractAdapter
attr_reader :http_accessor
def initialize(name, options)
super
@http = Resourceful::HttpAccessor.new
@http.logger = @options[:logger] || Resourceful... |
###################################################################
# Ruby Script to check if algorithm works in any of 32 posible states
# The riddle consist on a line of 5 people wearing a t-shirt with a white or black dot on the back.
# A killer with a gun asks each of them in order what's the dot's color on hi... |
require 'spec_helper'
describe Blog do
before do
@blog = Blog.new(title: "Hurray")
end
subject { @blog }
it { should be_valid }
# shoulda relations
it { should belong_to(:user)}
it { should belong_to(:main_photo).class_name('Photo')}
it { should have_many(:photo_sources).dependent(:destroy)}
i... |
class AddCountryAndWebsiteUrl < ActiveRecord::Migration[5.2]
def change
add_column :vet_profiles, :country, :string
add_column :vet_profiles, :website, :text
end
end
|
class Peep
include DataMapper::Resource
property :id, Serial
property :message, String, required: true
property :username, String
property :created_at, DateTime
belongs_to :user
end
|
class BlogEntriesController < ApplicationController
before_action :authenticate_user!, :except => [:show]
def new
@blog_entry = BlogEntry.new
end
def create
@blog_entry = BlogEntry.new(blog_entry_params)
if @blog_entry.save
flash[:notice] = "La entrada de blog ha sido guardada con éxito"
... |
class BooksController < ApplicationController
before_action :set_author, only: [:new, :create, :update]
def new
@user = current_user
@book = @author.books.build
respond_to do |format|
format.html
format.js
end
end
def create
@book = @author.books.build(book_params)
if @book... |
# =============================================================================
#
# MODULE : lib/dispatch_queue_rb/internal/thread_pool_queue.rb
# PROJECT : DispatchQueue
# DESCRIPTION :
#
# Copyright (c) 2016, Marc-Antoine Argenton. All rights reserved.
# =====================================================... |
class ReleaseValidationsController < ApplicationController
# GET /release_validations
# GET /release_validations.json
def index
@release_validations = ReleaseValidation.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @release_validations }
end
end
#... |
require "HTTParty"
require 'digest'
require 'rmagick'
require 'jaro_winkler'
class Arty
# Provide the names of the artists to render upon initialisation
def initialize(names)
@artists = names
@artwork_urls = []
@artwork_images = []
end
# Use the iTunes API to fetch the artwork images
# for the ... |
#!/usr/bin/env ruby
# script will, given a path for projection manifests
# figure out what namespaces need to be created ahead of time
# output: list of <cluster>/<namespace> ...
# example: bf2-DEVEL/foo bf2-PRODUCTION/bar
require 'yaml'
require 'find'
require 'pathname'
path = ARGV[0] || '.'
abort "Require manifests ... |
require_relative 'feed_persistence_service'
require_relative 'feed_updater'
class UpdateFeedTask
def initialize feed_persistence_service = FeedPersistenceService.new, feed_updater = FeedUpdater.new
@feed_persistence_service = feed_persistence_service
@feed_updater = feed_updater
end
def invoke
@feed... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
json.array!(@scholarships) do |scholarship|
json.extract! scholarship, :id, :first_name, :last_name, :email, :phone, :gender, :birth_date, :employment_status, :reason, :future_plans, :full_program, :traineeship, :bootcamp_id
json.url scholarship_url(scholarship, format: :json)
end
|
class K0310
attr_reader :options, :name, :field_type, :node
def initialize
@name = "Weight Gain: Gain of 5% or more in the last month or gain of 10% or more in the last 6 months. (K0310)"
@field_type = DROPDOWN
@node = "K0310"
@options = []
@options << FieldOption.new("^", "NA")
@options <... |
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
def gif_urls
urls = self.gifs.collect{|gif| gif.url}
end
def gif_for_empty_pg(page)
case page
when page == "user"
"https://media1.giphy.com/media/xieuDEXX78OYw/giphy.gif?cid=e1bb72ff5b721ced653062486f766c3b"
when page == "/... |
module ControllerMacros
def login_user
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:user]
sign_in FactoryGirl.create(:user)
end
end
def login_admin
before(:each) do
@request.env["devise.mapping"] = Devise.mappings[:admin_user]
sign_in FactoryGirl.crea... |
#
# Cookbook:: docker-cookbook
# Recipe:: docker_service
#
# Copyright:: 2017, Steven Praski
#
# 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.apache.org/licenses/LICENSE-2.0... |
class RenameBankToBankId < ActiveRecord::Migration[5.0]
def change
remove_column :cards, :bank, :integer, null: false
add_column :cards, :bank_id, :integer, null: false
add_index :cards, :bank_id
end
end
|
FactoryGirl.define do
factory :coupon do
code { ('a'..'z').to_a.sample(5).join }
status { [true,false].sample }
user { create :user, :seller }
discount { Random.rand(1..100) }
end
end |
class TransactionsController < ApplicationController
load_and_authorize_resource
skip_before_action :verify_authenticity_token, only: [:change_status]
before_action :set_transaction, only: [:destroy]
def index
@transactions = current_user.admin? ? Transaction.all : current_user.transactions
@transacti... |
# obsolete, only here for reference
=begin
module RestoreAgent
class Snapper
require 'restore_agent/object_db'
include DRbUndumped
attr_reader :object_db
def initialize(agent)
@agent = agent
@object_db = ObjectDB.new("/tmp/myobjects.db")
puts "snapper initialized"
end
... |
class Ability
include CanCan::Ability
def initialize(user)
if user.admin?
can :manage, :all
else
can :read, Ticket do |ticket|
ticket.nil? || ticket.published? || ticket.user == user
# deleted, archived?
end
can :read, Page do |page|
page.nil? || page.... |
class ReviewSerializer < ActiveModel::Serializer
attributes :reviewer, :rating, :comment
end
|
class NewsHeadlines::Article
attr_accessor :title, :author, :news_source, :description, :url, :published_at
@@all = []
def initialize(title = nil, author = nil, description = nil, url = nil, published_at = "unavailable")
@title = title
@author = author
@description = description
@url = url
@p... |
class Teacher < ApplicationRecord
validates :surname, presence: true,
length: { minumum: 2, maximum: 30 }
end
|
# Write a #french_ssn_info method extracting infos from French SSN (Social Security Number) using RegExp.
# Regular Expressions are useful in two main contexts: data validation and data extraction.
# In this challenge, we are going to use RegExps to extract data from a French social security number.
# check if ther... |
# == Schema Information
#
# Table name: contributions
#
# id :integer not null, primary key
# amount :float
# project_id :integer
# user_id :integer
# payment_status :string(255) default("UNPROCESSED")
# anonymous :boolean default(FALSE)
# created_at ... |
# frozen_string_literal: true
module InterventionSteps
step 'I create an intervention' do
@intervention = Fabricate(:intervention)
create_intervention
end
step 'I create an intervention with :num file(s)' do |num_files|
@intervention = Fabricate(:intervention)
create_intervention(num_files.to_i)... |
class EmployeesController < ApplicationController
before_filter :signed_in_employee, only: [:index, :edit, :update]
before_filter :correct_employee, only: [:edit, :update]
before_filter :admin_employee, only: :destroy
# GET /employees
# GET /employees.json
def index
@employees = Employee.paginate... |
require "eventmachine"
require "bite_the_dust/version"
BTD = BiteTheDust
module BiteTheDust
def self.future?(time)
Time.now < time
end
def self.countdown(sec, &block)
EM.run do
EM.add_timer(sec) do
EM.stop_event_loop
return block.call
end
end
end
class Bite... |
require "spec_helper"
describe StudyClient do
it "has a version number" do
expect(StudyClient::VERSION).not_to be nil
end
it "has a cost_code" do
expect(StudyClient::Node.new).to respond_to :cost_code
end
it "is connected to the json api" do
url='http://localhost:9999/api/v1/'
id="123"
... |
require 'rails_helper'
RSpec.describe "pages/home.html.erb", type: :view do
it "renders the game main page" do
render
assert_select "h1", :presence => true
assert_select "h1", :text => "HEART OF BOLD".to_s, :count => 1
assert_select "#gameContainer", :presence => true
end
end
|
require 'spec_helper'
module YahooGeminiClient
RSpec.describe GenerateMemberURI, ".execute" do
let(:base_uri) { "http://base.com" }
it "sets the query to be the given IDs" do
expect(described_class.execute(base_uri, [4, 5])).
to eq "http://base.com?id=4&id=5"
expect(described_class.execu... |
# frozen_string_literal: true
require 'spec_helper'
describe 'running ExUnitRunAll command' do
it "passing test" do # {{{
content = <<~EOF
|| **CWD**%%DIRNAME%%
|| .
|| 1 test, 0 failures
EOF
expect(<<~EOF).to be_test_output("ExUnitRunAll", content)
defmodule A do
use ExUnit.Case
test "truth" do
as... |
class AddColNameToBuilding < ActiveRecord::Migration
def change
add_column :buildings, :name, :string
add_column :buildings, :rank, :integer
end
end
|
class SessionsController < ApplicationController
skip_before_filter :authorize, :only => [:new, :authenticate]
before_filter :restrict_if_logged_in, :only => :new
def new
@title = "Login"
@member = Member.new
end
def delete
session[:member_id] = nil
cookies.delete :remember_me_id if co... |
class ParkingLot < ActiveRecord::Base
belongs_to :parking_type
attr_accessible :user_id, :parking_type_id, :latitude, :longitude
validates :user_id, :presence => true
validates :parking_type_id, :presence => {:message => "Tienes que seleccionar el tipo de plaza"}
validates :latitude, :presence => true
valid... |
include Warden::Test::Helpers
=begin NOT USED
Given(/^I set up some demo data$/) do
#for now, one team, one Objective.
t = Team.create!(name: "The Protons")
g = t.goals<< Goal.create!(team: t, name: "Be massively awesome")
end
=end
When(/^I visit the (?:key result|objective|goal) called "([^"]*)"$/) do |name... |
module Friendship
class Friend
attr_accessor :name, :sex, :age
def initialize(name, sex, age)
@name = name
@sex = sex
@age = age
end
def male?
sex == :male
end
def female?
sex == :female
end
def over_eighteen?
age > 18
end
def long_name?... |
require 'connection_pool'
require 'fastimage'
require 'thread'
require 'faraday'
require 'faraday_middleware'
require 'base64'
module ProgImage
class Client
IMAGES_ENDPOINT = '/images'.freeze
CONTENT_TYPE = 'application/json'.freeze
def initialize(pool_size: 3, timeout: 5)
self.pool = Connecti... |
class PagesController < ApplicationController
expose :page, -> { Page.friendly.find(params[:id]).decorate }
def show; end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.