text stringlengths 10 2.61M |
|---|
# Singleton Pattern
class SimpleLogger
@@instance = SimpleLogger.new
def self.instance
return @@instance
end
private_class_method :new
end
# Singleton Pattern (stdlib singleton module)
require 'singleton'
class SimpleLogger
include Singleton
end
# Singleton Pattern (module)
module ModuleBasedLogger
... |
require_relative 'graph'
require 'byebug'
# Implementing topological sort using both Khan's and Tarian's algorithms
def topological_sort(vertices)
sorted = []
visited = []
queue = Queue.new
vertices.each do |vertex|
queue.push(vertex) if vertex.in_edges.empty?
end
until queue.empty?
currentNod... |
class Admin::CharactersController < CharactersController
helper_method :sort_column, :sort_direction
after_action :verify_authorized, :except => [:index, :show]
def index
# @characters = current_user.characters.order(sort_column + " " + sort_direction)
@characters = Character.all
authorize @charac... |
require 'require_relative' if RUBY_VERSION[0,3] == '1.8'
require_relative 'acceptance_helper'
describe "export updates" do
include AcceptanceHelper
describe "logged in" do
before do
log_in_as_some_user
update = Fabricate(:update, :author => @u.author)
end
it "has a link to export all upda... |
class AddFreeCleaningToUsers < ActiveRecord::Migration
def change
add_reference :users, :free_cleaning_event, references: :events, index: true
add_foreign_key :users, :events, column: :free_cleaning_event_id
end
end |
class ApplicationController < ActionController::API
include ActionController::Cookies
before_action :confirm_authentication
private
def current_user
@current_user ||= session[:user_id] && User.find_by_id(session[:user_id])
end
def confirm_authentication
return render json: { error: "You must be l... |
# Copyright 2013 Square Inc.
#
# 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
#
# Unless required by applicable law or agreed ... |
# -*- encoding : utf-8 -*-
require 'test_helper'
class AcademicWorksControllerTest < ActionController::TestCase
setup do
@academic_work = academic_works(:one)
end
test "should get index" do
get :index
assert_response :success
assert_not_nil assigns(:academic_works)
end
test "s... |
module Admin
class TeamsController < BaseController
def new
@team = Team.new
build_default_home_options
build_permissions_options
end
def create
result = Admins::CreateTeam::Service.call(team_params, creator: current_user)
if result.success?
redirect_to admin_team_p... |
Dado('la prestación con nombre {string}') do |nombre|
@nombre_prestacion = nombre
end
Dado('costo unitario de prestación ${int}') do |costo|
@costo_prestacion = costo
end
Cuando('se registra la prestación') do
@request = {
'nombre': @nombre_prestacion,
'costo': @costo_prestacion
}
@response = Farad... |
class OrderItemController < ApplicationController
def create
id = params[:id]
@order = current_user.order
@order_item = @order.order_items.create(product_id: id)
@order.save
flash[:notice] = "You have added the item to your order..."
redirect_to current_user.order
end
def delete
@ord... |
RSpec.shared_context 'users and tasks' do
let(:rom) { ROM.setup(sqlite: SEQUEL_TEST_DB_URI) }
before do
conn = rom.sqlite.connection
conn.run('create table users (name STRING, email STRING)')
conn.run('create table tasks (name STRING, title STRING, priority INT)')
conn[:users].insert(name: "Joe",... |
class CreateApiV1Events < ActiveRecord::Migration[6.0]
def change
create_table :api_v1_events do |t|
t.integer :user_id
t.string :title
t.date :date
t.string :type
t.boolean :annual
t.string :description
t.integer :celebrator_id
t.timestamps
end
end
end
|
require 'ruby_tubesday'
require 'nokogiri'
require 'ostruct'
module SemanticExtraction
class << self
attr_reader :valid_extractors
attr_writer :valid_extractors
attr_reader :requires_api_key
attr_writer :requires_api_key
attr_reader :yahoo_api_key
attr_writer :yahoo_api_key
... |
require 'spec_helper'
describe MoviesController do
render_views
describe "GET index" do
before do
@studio1 = Factory :studio, :facebook_canvas_page => "http://www.fb.com"
@studio2 = Factory :studio, :facebook_canvas_page => "http://www.fb.com"
@zanzabar_hotel = Factory :movie, :studio => @... |
class ArticlesController < ApplicationController
ARTICLES_PER_PAGE = 10
expose_decorated(:articles) { |scope| paginated_articles(scope) }
expose_decorated(:article)
expose_decorated(:comments, ancestor: :article) { |scope| sorted_comments(scope) }
expose(:comment) { Comment.new }
def index
end
def s... |
require 'auto_complete'
# Manages actions relating to editing and modifying
# groups.
class GroupsController < ApplicationController
include GroupsHelper
# Administrator
# -
before_filter :authorize_only_for_admin
auto_complete_for :student, :user_name
auto_complete_for :assignment, :name
# TODO fi... |
class Department < ActiveRecord::Base
validates :name, :presence => true, :uniqueness => true
def num_of_class
return self.classes.length
end
def avg_score
return 0 if self.num_of_class <= 0
self.score / self.num_of_class
end
def score
self.classes.sum {|x| x.avg_score}
end
def class... |
(1..100).each do |number|
print number
print "Bit" if number % 3 == 0
print "Maker" if number % 5 == 0
puts
end
|
FactoryGirl.define do
factory :showback_event, :class => ManageIQ::Consumption::ShowbackEvent do
association :resource, :factory => :vm, :strategy => :build_stubbed
start_time 4.hours.ago
end_time 1.hour.ago
context {}
end
end |
def filter_list(l)
# return a new list with the strings filtered out
new_list = []
l.each do |element|
if element.is_a?(Integer) && element >= 0
new_list.push(element)
end
end
return new_list
end
|
require 'rails_helper'
RSpec.describe 'Command', type: :request do
let!(:command) { create(:command) }
let!(:command2) { create(:command) }
let(:user) { command.user }
let(:user2) { command2.user }
let(:send_index_request) { get api_command_index_path }
let(:send_new_request) { get new_api_command_path }
... |
ActiveAdmin.register Member do
permit_params :email, :password_digest, :first_name, :last_name, :phone_number, :graduation_year, :major, :member_status, :points
index :download_links => false do
selectable_column
id_column
column :email
column :first_name
column :last_name
column :phone_n... |
class UserLikesPost < ActiveRecord::Base
attr_accessible :value, :user_id, :post_id
belongs_to :user
belongs_to :post
end
|
# GenericContent: EXAMPLE Model that conforms to the Hydra genericContent and genericMetadata cModels
class Manuskript < ActiveFedora::Base
include Hydra::GenericContent
include Hydra::ModelMethods
# Uses the Hydra Rights Metadata Schema for tracking access permissions & copyright
has_metadata :name => "right... |
# Author:: Pavel Nazarov <pnazarov@gmail.com>
# Copyright:: Copyright (c) 2017 Pavel Nazarov
# License:: MIT
# URL:: https://github.com/alsvartr
# Simple and straightforward config & cli options parser
# Based on ruby-parseconfig class by BJ Dierkes <derks@datafolklabs.com>
# https://github.com/data... |
require File.dirname(__FILE__) + '/../../spec_helper'
describe "/enlace_urls/new.html.erb" do
include EnlaceUrlsHelper
before(:each) do
@enlace_url = mock_model(EnlaceUrl)
@enlace_url.stub!(:new_record?).and_return(true)
@enlace_url.stub!(:nombre).and_return("MyString")
@enlace_url.stub!(:descri... |
# frozen_string_literal: true
## --- BEGIN LICENSE BLOCK ---
# Original work Copyright (c) 2015-present the fastlane authors
# Modified work Copyright 2016-present WeWantToKnow AS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the... |
class ReferralsController < ApplicationController
before_action :set_referral, only: [:show, :update, :destroy]
# GET /referrals
def index
@referrals = Referral.all
render json: @referrals
end
# GET /referrals/1
def show
render json: @referral
end
# POST /referrals
def create
@refe... |
class GeolocationService
def initialize(search_string)
@search_string = search_string
end
## Get location requested by user through the search form
# or default to Cluj
def location
LocationPresenter.new(
Geocoder.search(search_string).first,
search_string
)
end
def search_strin... |
class TemplatesController < ApplicationController
def show
if template = get_template
render :partial => "templates/#{template}"
end
end
private
def get_template
params.require(:template).downcase
end
end
|
class CreateJobs < ActiveRecord::Migration
def change
create_table :jobs do |t|
t.string :status
t.references :jobable, polymorphic: true
t.string :job_type
t.jsonb :input, default: '{}'
t.jsonb :output, default: '{}'
t.datetime :end_at
t.datetime :start_at
t.times... |
# frozen_string_literal: true
module Whitelist
def self.table_name_prefix
'whitelist_'
end
end
|
require 'test_helper'
class MoviesControllerTest < ActionDispatch::IntegrationTest
test "should get index" do
get '/movies'
assert_response :success
end
test "should get show" do
get '/movies/1'
assert_response :success
end
test "should get rating" do
get '/movies/1/rating', xh... |
require_relative 'test_helper'
require 'nokogiri'
class MarkdownGeneratorTest < MiniTest::Test
attr_reader :generator
def setup
@generator = MarkdownGenerator.new
end
def test_fails_if_referenced_link_incorrect
error = assert_raises RuntimeError do
generator.html outdent(<<-EOF)
Something... |
class GamesQuestion < ActiveRecord::Base
belongs_to :game
belongs_to :question
has_many :answers
end |
class Classroom < ActiveRecord::Base
belongs_to :building
validates_presence_of :name, :capacity
validates_numericality_of :capacity, :only_integer => true, :greater_than => 0
validates_uniqueness_of :name, :scope=> :building_id
has_many :allocated_classrooms
end
|
class InformationController < ApplicationController
before_action :authenticate_user!
before_action :confirmed_user
before_action :admin_user, except: [:show]
def new
@info = Information.new(start_date: 1.week.since, expire_date: 6.days.since)
end
def create
@info = Information.create(info_params)... |
require "riddler/version"
require "faraday"
require "faraday_middleware"
require "liquid"
require "outlog"
require "predicator"
require "ulid"
require "riddler/includeable"
require "riddler/drops/hash_drop"
require "riddler/configuration"
require "riddler/context_builder"
require "riddler/context_builders/faraday_... |
# frozen_string_literal: true
require 'test_helper'
module Vedeu
class ViewTestClass
include Vedeu::View
end # ViewTestClass
describe View do
let(:described) { Vedeu::View }
let(:included_described) { Vedeu::ViewTestClass }
let(:included_instance) { included_described.new }
d... |
class QandASerializer
include FastJsonapi::ObjectSerializer
attributes :id,
:choice_id,
:question,
:choice,
:correct,
:updated_at,
:created_at
end
|
require 'tvfeed/source'
require 'uri'
class TVFeedSource::KASS < TVFeedSource
SOURCE_NAME = 'kass'
def initialize(config)
super
@search_url = 'http://kass.filesoup.co.uk/usearch/?q={{query}}'
end
def parse_results(html)
m = html.scan /<tr class="(even|odd)".*?>(.*?)<\/tr>/m
results = []
... |
class DefaultIsPrivate < ActiveRecord::Migration
def self.up
change_column_default(:deeds, :is_private, false)
end
def self.down
change_column_default(:deeds, :is_private, nil)
end
end
|
module Mhp2
def self.table_name_prefix
'mhp2_'
end
end
|
# ===================================================================================
# Print a list of location names, ordered by weekly revenue from highest to lowest
# ===================================================================================
# => Read from locations.json and customers.json files.
# => ... |
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# enum role: [:student, :admin]
# Include default d... |
#
# Cookbook Name:: mesos
# Spec:: master
#
require 'spec_helper'
describe 'mesos::master' do
context 'When all attributes are default, on CentOS 7' do
let(:chef_run) do
runner = ChefSpec::ServerRunner.new(platform: 'centos', version: '7.1.1503')
runner.converge(described_recipe)
end
it 'Inc... |
module Dabooks
class CLI::HelpCommand
DETAILS = {
description: "Displays a list of subcommands, or help for a specific subcommand.",
usage: "dabooks help [subcommand]",
schema: {},
}
def initialize(cli)
@subcommand = cli.free_args.first
end
def run
if @subcommand
... |
class ItemOrder
attr_reader :count, :code
attr_accessor :fulfilled
def initialize(count=0, code)
@count = count < 0 ? 0 : count
@code = code.upcase
@fulfilled = false
@bundles = {}
end
def to_s
"Ordered #{@count} items of item code #{@code}"
end
def add_bundle(quantity, price, bu... |
class RenameServiceIdInRecord < ActiveRecord::Migration
def change
rename_column :records, :service_id, :service_category_id
end
end
|
require "spec_helper"
describe ActiveRecord::FinderMethods do
before do
user
end
let(:user) {
u = User.new
u.id = 1
u.save
u
}
context "#find" do
context "pass an ID that exists" do
subject { User.find(1) }
it { is_expected.to eq(user) }
end
context "pass an ID... |
# frozen_string_literal: true
module Kafka
# Manages a consumer's position in partitions, figures out where to resume processing
# from, etc.
class OffsetManager
# The default broker setting for offsets.retention.minutes is 1440.
DEFAULT_RETENTION_TIME = 1440 * 60
def initialize(cluster:, group:, ... |
require 'test_helper'
class ArticleTest < ActiveSupport::TestCase
test "関連のテスト" do
article = FactoryGirl.create :article, :has_comments
assert_equal 1, article.comments.count
end
test "scope top_ten" do
create :article, title: "name1", pv: 1
create :article, title: "name2", pv: 2
create :art... |
module Mediators::Credentials
class HerokuRefresh < Mediators::Base
def initialize(args)
@user_id = args[:user_id]
end
def call
encrypted_tokens = $redis.hget(heroku_key, 'tokens')
expired_tokens = JSON.parse(Services::TokenStore.decrypt(encrypted_tokens))
refresh_token = exp... |
require 'spec_helper'
module Alchemy
describe Admin::ElementsHelper do
let(:page) { build_stubbed(:public_page) }
let(:element) { build_stubbed(:element, page: page) }
context "partial rendering" do
it "should render an element editor partial" do
expect(helper).to receive(:render_elemen... |
Learnhvac::Application.routes.draw do |map|
Jammit::Routes.draw(map)
resources :accounts, :only => [:create]
resources :user_sessions
resources :password_resets
resources :client_versions, :only => [:index]
resources :users, :only => [:update]
match 'login' => 'user_sessions#new', :as => 'login'... |
class CreateHelpfulResources < ActiveRecord::Migration
def change
create_table :helpful_resources do |t|
t.string :link
t.string :description
t.integer :vote_count
t.string :title
t.timestamps
end
end
end
|
require 'rails_helper'
RSpec.describe Game, type: :model do
describe 'associations' do
it { is_expected.to have_many(:rounds) }
end
describe 'validations' do
it { is_expected.to validate_length_of(:rounds) }
end
describe 'counter caches' do
let(:game) { create :game }
let(:user) { create :u... |
# load libraries and DSL
require "spec_helper"
# what we're expecting this thing to do
describe "Let People Sign Up For My Newsletter", :type => :feature, :js => true do
# first off, we expect there to be a page
# with a form and a button that says "Sign up"
it "Shows me the newsletter form" do
# there sho... |
require 'rails_helper'
RSpec.describe Item, type: :model do
describe Item do
before do
@item = FactoryBot.build(:item)
end
describe '商品情報登録' do
context '新規登録がうまくいくとき' do
it '全ての値が正しく入力されていれば登録できる' do
expect(@item).to be_valid
end
end
context '商品登録がうまくいか... |
Rails.application.routes.draw do
# The priority is based upon order of creation: first created has highest priority.
# See how all your routes lay out with 'rake routes'. Read more: http://guides.rubyonrails.org/routing.html
root to: "welcome#index"
end
|
module OpenXml
module Docx
module Elements
class NonbreakingHyphen < Element
tag :noBreakHyphen
end
end
end
end
|
require 'rails_helper'
RSpec.feature "Signing in" do
let!(:user) { Fabricate(:user, email: 'sherlock@example.com', password: 'e1m3taRY!#MyD3arWa2*', password_confirmation: 'e1m3taRY!#MyD3arWa2*') }
scenario "with valid credentials" do
sign_in_with_valid_credentials
expect(page).to have_content("You hav... |
class AddOpenAtToGouSites < ActiveRecord::Migration
def self.up
add_column :gou_sites, :open_at, :datetime
add_column :gou_gou_sites, :url, :string
end
def self.down
remove_column :gou_gou_sites, :url
remove_column :gou_sites, :open_at
end
end
|
require 'spec_helper'
describe VotesController, type: :controller do
render_views
let(:votable_owner) { FactoryGirl.create(:user) }
let(:votable) { FactoryGirl.create(:event, user: votable_owner) }
context "authenticated" do
let(:user) { FactoryGirl.create(:user) }
let(:my_votable) { FactoryGirl.creat... |
require "hutch/logging"
require "bugsnag"
require "hutch/error_handlers/base"
module Hutch
module ErrorHandlers
class Bugsnag < Base
def handle(properties, payload, consumer, ex)
message_id = properties.message_id
prefix = "message(#{message_id || "-"}):"
logger.error "#{prefix} Log... |
class AddTypeToHair < ActiveRecord::Migration
def change
add_column :hairs, :type, :string
end
end
|
# frozen_string_literal: true
require './secret_folder/secret_errors'
require 'rack'
RSpec.describe SecretFolder::SecretErrors do
subject { described_class.new(app) }
context '404' do
let(:request) { Rack::MockRequest.env_for('http://example.com:8080/asd') }
let(:app) { ->(_) { [404, {}, []] } }
it ... |
require File.dirname(__FILE__) + '/../../spec_helper'
require File.dirname(__FILE__) + '/fixtures/classes'
describe "StringIO#each_byte" do
before(:each) do
@io = StringIO.new("xyz")
end
it "yields each character code in turn" do
seen = []
@io.each_byte { |b| seen << b }
seen.should == [120, 121... |
module OperaWatir
class QuickToolbar < QuickWidget
# @private
# Checks the type of the widget is correct
def correct_type?
@element.getType == WIDGET_ENUM_MAP[:toolbar]
end
end
end
|
require 'data_mapper'
class Message
include DataMapper::Resource
property :id, Serial
property :body, Text
property :date, DateTime
belongs_to :user
end |
require('spec_helper')
describe(Patient) do
describe('.all') do
it('will return an empty array of Patients when there are none') do
expect(Patient.all()).to(eq([]))
end
end
describe('#save') do
it('will save a user inputed patient to the database') do
patient = Patient.new({:name => "Han... |
class Folder < ActiveRecord::Base
has_ancestry
attr_accessible :division_id, :subject_matter, :title, :user_id, :parent_id
belongs_to :user
has_many :documents
end
|
require 'spec_helper'
describe Ride do
describe ".this_year" do
let!(:first_ride) { Ride.create(:start_time => Time.now.utc.beginning_of_year) }
let!(:second_ride) { Ride.create(:start_time => Time.now.utc.end_of_year) }
let!(:third_ride) { Ride.create(:start_time => 1.year.ago) }
let!(:fourth_ride) ... |
# frozen_string_literal: true
class IncidentSerializer < BaseSerializer
attributes %i[id
title
description
user_id
status
pending
group_id
modifier_email
category_id
attachm... |
require 'spec_helper'
require 'date'
describe Aceroute::Order do
describe "create a new Order" do
before :all do
@location = Aceroute::Location.new(
"555 Sesame St", "#123", "Big Bird's House", "home",
"5551234", "330001")
@customer = Aceroute::Customer.new(
"Big Bird", "big@bird.c... |
require 'formula'
class Flocq < Formula
homepage 'http://flocq.gforge.inria.fr'
url 'http://gforge.inria.fr/frs/download.php/file/33979/flocq-2.4.0.tar.gz'
sha256 '9b7ed4dc6b14430f48cd9cc13980815228a49bda69f15fee9ecdee3ca7251d08'
depends_on 'coq'
def install
system "./configure", "--prefix=#{prefix}", ... |
class Api::Public::TimeslotsController < Api::Public::BaseController
before_filter :load_user
def index
appointment_type = AppointmentType.find(params[:appointment_type_id])
user = appointment_type.user
@timeslots = Timeslot.find_available(@user, DateTime.parse(params[:date]).in_time_zone(user.timezon... |
# coding: utf-8
require_relative 'validation'
require_relative 'player'
class User < Player
include Validation
validate :name, :presence
validate :name, :type, String
def initialize(name = "User")
super(name)
validate!
end
end |
class PhotoSerializer < ActiveModel::Serializer
attributes :id, :name, :description, :license, :visibility
belongs_to :user, serializer: UserPhotoIndexSerializer
end
|
require 'test_helper'
class ServiceProvidersControllerTest < ActionDispatch::IntegrationTest
test 'should get root without session' do
get(root_path)
assert_response(:success)
assert_nil(assigns(:sps))
assert_nil(assigns(:new_sp))
end
test 'should get root with session' do
sign_in_as(:great_... |
class AddAnswerChoiceToResponses < ActiveRecord::Migration
def change
add_column :responses, :answer_choice, :boolean
end
end
|
require "prawn"
require "prawn/measurement_extensions"
require "prawn_shapes"
require "prawn/table"
# Card sizes are:
# ships 70x120mm
# upgrades 44x68mm
#
# 72 points per inch
# 25.4 mm per inch
#
# ships 70/25.4*72 x 120/25.4*72
# 198.4 x 340.2
# upgrades 44/25.4*72 x 68/25.4*72
# 124.... |
FactoryGirl.define do
factory :banner do
photo { generate :url }
banner_type { Banner.banner_type.values.sample }
state { Banner.state_machines[:state].states.map(&:name).first.to_s }
end
end
|
module Wisper
describe Configuration do
describe 'broadcasters' do
let(:broadcaster) { double }
let(:key) { :default }
it '#broadcasters returns empty collection' do
expect(subject.broadcasters).to be_empty
end
describe '#broadcaster' do
it 'adds given broad... |
class ApiKey < ActiveRecord::Base
before_validation :generate_api_key
belongs_to :user
private
def generate_api_key
self.api_key ||= SecureRandom.hex
end
end
|
class PersonGroups::OptionsSerializer < ApplicationSerializer
object_as :person_group
attributes :id, :slug, :name
end
|
module Belafonte
module Help
module AppExtensions
def root
return self unless parent
parent.extend(AppExtensions)
parent.root
end
def root?
root == self
end
def executable
File.basename($0)
end
def display_title
root? ? e... |
class GameEngine
class Error < StandardError; end
class IllegalMove < Error; end
class OutOfTurn < Error; end
def self.run(options = {})
Go::GTP.run_gnugo do |gtp|
gtp.boardsize(options[:board_size]) unless options[:board_size].to_s.empty?
gtp.fixed_handicap(options[:handicap]) if options[:hand... |
require 'rails_helper'
RSpec.describe UsersController, type: :controller do
describe "GET #show" do
login_user(:user_with_albums, albums_count: 11)
let(:user) { current_user }
let(:request_exec) { get :show, params: { id: user.id } }
context 'logged in user' do
before(:each) { request_exec }
... |
require 'spec_helper'
require 'bosh/dev/stemcell_dependency_fetcher'
require 'bosh/dev/download_adapter'
module Bosh::Dev
describe StemcellDependencyFetcher do
include FakeFS::SpecHelpers
subject { described_class.new(downloader, logger) }
let(:downloader) { instance_double(Bosh::Dev::DownloadAdapter) ... |
############################################################
#
# Name: Sean Kanaley
# Assignment: Rock Paper Scissors
# Date: 1/30/2017
# Class: CIS 282
# Description: Create a game of rock, paper, scissors, lizard, Spock. Where the computer randomly picks and the player chooses.
# Outputs the resu... |
require 'digest/sha1'
# this model expects a certain database layout and its based on the name/login pattern.
class User < ActiveRecord::Base
has_and_belongs_to_many :groups
has_many :tubes
has_many :tube_histories_as_old_user, :class_name => "TubeHistory", :foreign_key => "old_user_id"
has_many :tube_histor... |
require 'test/unit'
require 'soap/baseData'
module SOAP
class TestSOAP < Test::Unit::TestCase
NegativeZero = (-1.0 / (1.0 / 0.0))
def setup
# Nothing to do.
end
def teardown
# Nothing to do.
end
def assert_parsed_result(klass, str)
o = klass.new(str)
assert_equal(str, o.to_s)
end
... |
@animes.each do |anime|
json.set! anime.id do
json.extract! anime, :id, :title, :description, :genre
if anime.photo.attached?
json.photo_url url_for(anime.photo)
else
json.photo_url ''
end
end
end |
require 'gilded_rose'
require 'item'
describe GildedRose do
describe '#update_quality for... ' do
describe 'Aged brie' do
it 'Aged brie quality actually increases by 1 when updated' do
items = [Item.new('Aged Brie', 10, 10)]
expect { GildedRose.new(items).update_quality }
.to(chang... |
module ProposalSpecHelper
def linear_approval_statuses(proposal)
proposal.individual_steps.pluck(:status)
end
def fully_complete(proposal, completer = nil)
proposal.individual_steps.each do |step|
step.reload
step.complete!
step.update(completer: completer) if completer
end
end
en... |
class Delivery < ActiveRecord::Base
has_carbon_data_stored_in_amee :profile => :project, :repetitions => true
cattr_reader :per_page
COLOUR = "#FFBA4E"
TYPE = {
:van => AmeeCategory.new("Van", :distance, "/transport/van/generic/defra", :fuel => "diesel", :size => "1.305 to 1.740 tonnes"),
:non_artic... |
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/ios-checkboxes/version', __FILE__)
Gem::Specification.new do |s|
s.name = "ios-checkboxes"
s.version = IOSCheckboxes::VERSION
s.authors = ["Thomas Reynolds"]
s.email = ["me@tdreyno.com"]
s.homepage = "https://github.com/tdreyn... |
require 'spec_helper'
describe "sessions/new.html.haml" do
it "have a form" do
render
rendered.should have_selector("form", :method => "post", "action" => login_path)
rendered.should have_content("Forgot your password?")
rendered.should have_selector("form", :method => "post", "action" => password_re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.