text
stringlengths
10
2.61M
class CreateRoles < ActiveRecord::Migration[5.2] def up create_table :roles do |t| t.string "name", :limit => 200 #Role Name t.string "description", :limit => 200 #xxx t.string "code", :limit => 10 #short code for role i.e. SPE, SEV, CHA, TOA t.integer "role_type_id" #Role Type ID t...
module V1 class PetAPI < Base before do authenticate! end resource :mypets do desc "Get user'pet list" get do @current_user.pets.as_json(methods: [:avatar_url, :cover_url]) end desc "Return a pet of user" params do requires :pet_id, type: Integer, desc: "Pet's id." end ...
module IGN module Game class << self def search(name, options = {}) search_options = construct_search_options(name, options) response = get_search_response(search_options) parse response end private def get_search_response(options) ::IGN::Search.new('/sear...
class Game < ApplicationRecord has_many :events has_many :attendees, through: :events has_many :user_games end
class IntegerFormatValidator < ActiveModel::EachValidator # :nodoc: ZERO_DECIMAL_REGEXP = /\A0+\.0+\z/.freeze # 00.000 def validate_each(record, attribute, value) Integer(value) rescue ArgumentError integer = value.to_i return if integer == value.to_f && (integer != 0 || value.match(ZERO_DECIMAL_REG...
class ChangeColumnType < ActiveRecord::Migration def change change_column :users, :twitter_id, :bigint end end
require 'spec_helper' require 'yt/models/match_policy' describe Yt::MatchPolicy, :partner do subject(:match_policy) { Yt::MatchPolicy.new asset_id: asset_id, auth: $content_owner } context 'given an asset managed by the authenticated Content Owner' do before { Yt::Ownership.new(asset_id: asset_id, auth: $cont...
require 'benchmark' require '../colors' def count_trees(rows, step) rows.each_with_index.count do |row, index| if (index % step[1]) == 0 row.strip! y = index / step[1] x = y * step[0] row[x % row.length] == '#' else false end end end def answer_icon(result, step) answe...
class EditCheck attr_accessor :description1, :description2, :description3, :left, :right def initialize @left = [] @right = [] end def error_message "#{half_error_message @left} should be equal to #{half_error_message @right}" end def half_error_message side result = "" side.each do |...
require_relative 'aoe.rb' require_relative 'mdraid.rb' class StartVirtualDiskSaga < Saga STATE_CHECK_EXPORTS = 1 attr_reader :disk_number def start(disk_number, message = nil) @original_message = message @disk_number = disk_number Log4r::Logger['kb'].info "++ Starting saga #{id}: Activate VD #{sel...
# frozen_string_literal: true class LessonsController < HtmlController include Pagy::Backend has_scope :exclude_deleted, type: :boolean, default: true has_scope :table_order, type: :hash, only: :index, default: { key: :date, order: :desc } # has_scope cannot have 2 scopes with the same name. table_order_lesson...
class Drop < ActiveRecord::Migration def change drop_table :vendingmachines end end
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper") describe "Dataset#select_remove" do before do @d = Sequel.mock.from(:test).extension(:select_remove) @d.columns :a, :b, :c end specify "should remove columns from the selected columns" do @d.sql.should == 'SELECT * FROM tes...
class DropboxConfig APP_KEY = ENV["DROPBOX_APP_KEY"] APP_SECRET = ENV["DROPBOX_APP_SECRET"] ACCESS_TOKEN = ENV["DROPBOX_ACCESS_TOKEN"] ACCESS_TOKEN_SECRET = ENV["DROPBOX_ACCESS_TOKEN_SECRET"] USER_ID = ENV["DROPBOX_USER_ID"] ACCESS_TYPE = ENV["DROPBOX_ACCESS_TYPE"] SUBFOLDER = Rails.env == 'staging' ? 'pr...
class Recipe < ApplicationRecord acts_as_taggable_on :materials belongs_to :category validates :rakuten_id, uniqueness: true end
# frozen_string_literal: true class GraduationsController < ApplicationController include GraduationAccess CENSOR_ACTIONS = %i[add_group approve create disapprove edit graduates_list graduates_tab index lock new show update].freeze before_action :admin_required, except: CENSOR_ACTIONS be...
class Student < ActiveRecord::Base AREAS_OF_INTEREST = { "general" => 1, "software development" => 2, "information technology" => 3, "game design and new media" => 4, } validates :firstName, :lastName, :email, :interest, presence: true #validates_format_of :firstName, #validates_format-of :last...
class ConversationsController < ApplicationController before_filter :require_user, :only=>[:new, :create, :new_node_contribution, :preview_node_contribution, :confirm_node_contribution] # GET /conversations def index @active = Conversation.includes(:participants).latest_updated.limit(3) @popular = Conver...
require 'rails_helper' RSpec.describe "medications/new", type: :view do before(:each) do assign(:medication, Medication.new( :name => "MyString", :dosage => "MyString", :description => "MyString" )) end it "renders new medication form" do render assert_select "form[action=?][m...
require 'rspec/core/rake_task' require 'rubygems/package_task' require 'rake/extensiontask' require 'rake/javaextensiontask' require 'rake/clean' require 'rdoc/task' require 'benchmark' CLEAN.include( "tmp", "lib/bcrypt_ext.jar", "lib/bcrypt_ext.so" ) CLOBBER.include( "doc", "pkg" ) GEMSPEC = Gem::Specifica...
class Blackjack attr_accessor :player, :dealer, :deck def initialize @player = Player.new @dealer = Dealer.new @deck = ([1,2,3,4,5,5,6,7,8,9]*4 + [10]*16).shuffle! end def deal_to_player self.player.hand << self.deck.pop end def deal_to_dealer self.dealer.hand << self.deck.pop end def deal_cards ...
class Users::ApplicationController < ApplicationController helper_method :current_user def current_user warden.user(:user) end private def authenticate_user! unless warden.authenticated?(:user) redirect_to new_session_path end end end
Mime::Type.register "application/rdf+xml", :rdf class UsersController < ApplicationController protect_from_forgery :except => :update def show @user = User.where(:domain_name => params[:domain_name], :screen_name => params[:screen_name]).first forbidden if @user.private? and @user != @login_user @use...
#!/usr/bin/env ruby require 'rubygems' if ARGV.empty? "Usage: convert [--tidy] source.html" exit end tidy = false html = nil if ARGC[0] == '--tidy' tidy = true html = ARGV[1] end html ||= ARGV[0] pdf = html.gsub(/\.html/, '.pdf') fo = html.gsub(/\.html/, '.fo') style = 'xhtml2fo' if tidy `tidy #{html} -b ...
require 'csv' require 'json' namespace :seeds do desc 'seed airport data from openflights.org' task :airports, %i[country_column_name] => :environment do |_, args| raise :airport_model_not_found unless defined?(Airport) country_column_name = args.country_column_name || 'country' data_sets = ...
$LOAD_PATH.unshift(root_path('vendor', 'sinefunc', 'will_paginate', 'lib')) require root_path('vendor/sinefunc/will_paginate/lib/will_paginate/finders/active_record') require root_path('vendor/sinefunc/will_paginate/lib/will_paginate/view_helpers/base') require root_path('vendor/sinefunc/will_paginate/lib/will_paginat...
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable has_many :workunits, :foreign_key => "perfor...
# Cookbook Name:: nginx # Recipe:: repo_passenger # Author:: Jose Alberto Suarez Lopez <ja@josealberto.org> # # 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/...
class LineItem < ActiveRecord::Base attr_accessible :cart_id, :product_id, :quantity, :price belongs_to :product belongs_to :cart def total_price product.price * quantity end end
class Playlist < ActiveRecord::Base has_and_belongs_to_many :songs validates :name, presence: true, uniqness: true def add_song(song) end def remove_song(song) end end
# Enter your procedural solution here! =begin #55 - input #is the input divisble by 2 ? if not increment 2 by 1 is the input now divisble by 3? ( No, repeat step ) if not increment 3 by 1 is the input divisible by 4? if not increment 4 by 1 is the input divisble by 5 yes. 55 / 5 = 11 store input as 11. store a var...
FactoryBot.define do factory :cospul_picture, class: CospulPicture do picture {File.open("#{Rails.root}/app/assets/images/kaonashi_bl.png")} association :cospul, factory: :cospul end end
class Api::V1::Staff::StaffsController < Api::V1::Staff::BaseController def index render json: StaffSerializer.new(Staff.all.order(created_at: :desc)).serialized_json end def create staff = Staff.new(staff_params) if staff.save render json: StaffSerializer.new(staff).serialized_json else ...
class Indocker::ServerPools::DeployServerPool def initialize(configuration:, logger:) @logger = logger @configuration = configuration @connections = [] @semaphore = Mutex.new end def create_connection!(server) connection = Indocker::ServerPools::DeployServerConnection.new( logger: @logg...
class AddBillingCountryToOrders < ActiveRecord::Migration def change add_column :orders, :billing_country, :string end end
FactoryGirl.define do factory :admin_user, :class => AuthForum::AdminUser do |f| f.sequence(:email) { |n| "admin#{n}@auth_forum.com"} password "123456789" end end
# frozen_string_literal: true require 'rails_helper' RSpec.describe User, type: :model do describe 'Validations' do it { is_expected.to validate_presence_of(:name) } it { is_expected.to validate_presence_of(:email) } it { is_expected.to validate_presence_of(:cpf) } it { is_expected.to validate_leng...
module Relevance module Tarantula # This fuzzer, would fill the known parameter on the RestRoute with the input from the attack # object. (with uri.encoded) class RestValuesFuzzer < RestParametersFuzzer class << self # For every attack registered on this fuzzer, create a different fuzzer. ...
describe 'Portfolios RBAC API' do let(:tenant) { create(:tenant) } let!(:portfolio1) { create(:portfolio, :tenant_id => tenant.id) } let!(:portfolio2) { create(:portfolio, :tenant_id => tenant.id) } let(:access_obj) { instance_double(RBAC::Access, :owner_scoped? => false, :accessible? => true, :id_list => [port...
class Product < ActiveRecord::Base belongs_to :user has_many :bids, dependent: :destroy has_many :reviews, dependent: :destroy def show_winner bid_winner = bids.max {|a,b| a.amount <=> b.amount } (bid_winner) ? bid_winner.user.name : "None" end def get_max_bid max_bid = bids.max{|a,b| a.amount...
class Account < Account.superclass module Cell # model: an Account. returns the accounts signup date in the format m/d/y class SignedUp < Abroaders::Cell::Base property :created_at def show created_at.strftime('%D') end end end end
# == Schema Information # # Table name: orders # # id :integer not null, primary key # consumer_id :integer # address_id :integer # state :string(255) # total_price :float(24) # created_at :datetime not null # updated_at :...
# # Copyright 2009 Huygens Instituut for the History of the Netherlands, Den Haag, The Netherlands. # # This file is part of New Women Writers. # # New Women Writers is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundat...
class AddDefaultsToIntersate < ActiveRecord::Migration def change change_column :jobs, :interstate_pallet_id, :integer, :default => 0 end end
# frozen_string_literal: true RSpec.describe 'BundlerAuditEnsurance' do let(:success) { 'No vulnerabilities found' } it 'does not have vulnerability warnings' do command = 'bin/bundler-audit check' result = `#{command}` message = "Bundler Audit has warnings, run '#{command}' to show them" expect(...
require 'spec_helper' describe Todo, '#user=' do it "assignes owner_email from the user passed in email" do user = User.new('me@mail.com') todo = Todo.new todo.user = user expect(todo.owner_email).to eq 'me@mail.com' end end
require "paperclip/matchers" module Paperclip # =Paperclip Shoulda Macros # # These macros are intended for use with shoulda, and will be included into # your tests automatically. All of the macros use the standard shoulda # assumption that the name of the test is based on the name of the model # you're te...
class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :name t.string :screen_name, uniqueness: true t.timestamps end create_table :external_accounts do |t| t.integer :user_id, null: false t.index :user_id t.string :type t.stri...
class AbstractPhpVersion < Formula module PhpdbgDefs PHPDBG_SRC_TARBALL = "https://github.com/krakjoe/phpdbg/archive/v0.3.2.tar.gz".freeze PHPDBG_CHECKSUM = { :sha256 => "feab6e29ef9a490aa53332fe014e8026d89d970acc5105f37330b2f31e711bbd", }.freeze end module Php56Defs PHP_SRC_TARBALL = "h...
class Shopper < ApplicationRecord include EmailValidable has_many :orders, dependent: :nullify validates :nif, presence: true, uniqueness: { case_sensitive: false } end
module Pacer module Filter class KeyIndex attr_reader :graph, :element_type def initialize(graph, element_type) @graph = graph @element_type = element_type end # FIXME: there is no count for key indices anymore. I'm counting # up to 10 elements to try to find good i...
class Admin::SpeciesController < Admin::ApplicationController load_and_authorize_resource respond_to :html, :xml, :json # GET /species # GET /species.xml def index @search = Species.includes(:animals).organization(current_user).search(params[:q]) @species = @search.result.paginate(:page => param...
grocery_list = ["peanut butter", "yogurt", "onions", "red wine vinegar"] # 1. Display grocery list according to specified formatting grocery_list.each do |item| puts "* #{item}" end # 2. Add "rice" to grocery list, then display list grocery_list << "rice" grocery_list.each do |item| puts "* #{item}" end # 2.1 W...
cwd = File.dirname(__FILE__) $LOAD_PATH << File.join(cwd, '..', 'gen-rb') require 'account_creator' require 'bank_types' require 'standard_client' require 'premium_client' require 'securerandom' class AccountCreatorHandler def initialize transport = Thrift::BufferedTransport.new(Thrift::Socket.new('localhost', 2...
class Admissions::PromoInstancesController < Admissions::AdmissionsController before_filter :set_promo_instance, except: [:index, :new, :create] before_filter :set_pages, only: [:new, :edit, :update, :create] load_resource find_by: :permalink authorize_resource def index @promo_instances = PromoInstance....
module FunWithStrings def palindrome? s = self.downcase.gsub(/\W/,"") s == s.reverse end def count_words h = Hash.new(0) self.split(/\W/).select {|w| !w.empty?}.each {|w| h[w.downcase] += 1} h end def anagram_groups self.split.group_by {|w| w.downcase.chars.sort}.values end end # ma...
require 'sqlite3' class BlocRecord attr_accessor :table def initialize(default_table) @db = SQLite3::Database.new(".data.db") @table = (default_table) end def bark puts "Woof!" end def db @db end def create_table(title, schema, foreign_keys = []) ...
Rails.application.routes.draw do resources :votes resources :tags resources :places resources :users # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root 'places#index' post '/login' => 'sessions#login', as: :login end
class ItemCat< ApplicationRecord validates :name, presence: true has_many :item end
################# # Blank ################# class Object def blank? respond_to?(:empty?) ? !!empty? : !self end end ################# # Humanize ################# class String def humanize sub(/\A_+/, '') .tr('_', ' ') .sub(/\A\w/) { |match| match.upcase } end end class Symbol def humani...
class ApplicationController < ActionController::Base protect_from_forgery with: :exception before_action :authorize, :set_gopay protected def authorize unless User.find_by(id: session[:user_id]) redirect_to home_path, notice: 'Please Login' end end def set_gopay Gopay.all....
class Boat < ActiveRecord::Base belongs_to :captain has_many :boat_classifications has_many :classifications, through: :boat_classifications def self.first_five Boat.limit(5) end def self.dinghy Boat.where("length < ?", 20) end def self.ship Boat.where("length >= ?", 20) end d...
require 'spec_helper' describe package('oracle-java8-installer') do it { should be_installed } end describe package('oracle-java8-set-default') do it { should be_installed } end describe command('java -version') do it { should return_stdout /java version/ } it { should return_stdout /build 1.8/ } end
# # Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. # # 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 ...
['pp', 'date'].each {|lib| require lib} module RickyNg class << self attr_accessor :work_history def pretty_print(pp) pp self.instance_variables.map{|k| {k.to_s.gsub('@', '') => self.instance_variable_get(k)}} end end @contact = { email: 'dummey@gmail.com', phone: '510-590-6889', ...
$: << 'test' require 'minitest/autorun' require 'vrbo' require 'support/calendar_dates' class CalendarTest < MiniTest::Unit::TestCase include CalendarDates def calendar_id 212121 end def test_available_with_all assert_equal true, available?(all) end def test_available_with_random assert_equa...
class Course < ActiveRecord::Base #has_many :syllabus has_many :topics end
# In this exercise, you will be creating two classes AND the driver code to test them. # You will create a Tv class and a Remote class. # The Tv class will have the attributes: power, volume, and channel. # The Remote class will have just one attribute: tv. This will represent which tv it # actually controls. # The...
class Document < Upload belongs_to :uploadable, :polymorphic => true has_attached_file :upload, :path => ":rails_root/public/system/uploads/documents/:id/:style_:basename.:extension" validates_attachment_presence :upload validates_attachment_content_type :upload, :content_type => [ ...
class CreateImages < ActiveRecord::Migration def up create_table :images do |t| t.text :url t.text :caption t.integer :filesize t.integer :post_id end end def down drop_table :images end end
require 'roar/json' module PlaceRepresenter include Roar::JSON property :lat property :long property :name property :description property :recommended_by property :date_added property :date_visited property :comments property :current end
# == Schema Information # # Table name: contacts # # id :integer(4) not null, primary key # first_name :string(255) # last_name :string(255) # created_at :datetime # updated_at :datetime # email :string(255) # device_id ...
# -*- coding: utf-8 -*- require 'gtk2' module Gdk module TextSelector START_TAG_PATTERN = /<\s*\w+.*?>/ END_TAG_PATTERN = %r{</.*?>} ENTITY_ENCODED_PATTERN = /&(?:gt|lt|amp);/ CHARACTER_PATTERN = /./m CHUNK_PATTERN = Regexp.union(START_TAG_PATTERN, END_TAG_PATTERN...
ActiveRecord::Base.class_eval do def self.relations_meta(combined_key, association_type) combined_key.singularize.camelize.constantize.reflect_on_all_associations(association_type).map{|r| [r.name, {foreign_key: r.options[:foreign_key], through: r.options[:through].to_s, class_name: r.options[:source] || r.plur...
class EconomicEventsController < ApplicationController before_action :authenticate_user! before_action :set_economic_event, only: [:show, :edit, :update, :destroy] before_action :set_date, only: :index # GET /economic_events # GET /economic_events.json def index @company_information = CompanyInformatio...
# encoding: UTF-8 # frozen_string_literal: true $: << File.dirname(__FILE__) require 'test_helper' begin require 'builder' require 'stringio' rescue LoadError # do nothing end begin require 'json' rescue LoadError # do nothing end class GeosWriterTests < Minitest::Test include TestHelper def initiali...
Rails.application.routes.draw do root "landing#index" devise_for :users resources :cost_details resources :cars do member do get 'select' get 'dashboard' get 'reports' get 'gas_consume' get 'update_current_km' get 'image_detach' get 'image_detach' ...
class Api::ProjectsController < ApplicationController before_action :set_project, only: %i(show) # GET /projects def index projects = Project.all render json: serialize_with_all_engineers(projects) end # GET /projects/1 def show render json: serialize_with_associated(@project) end # POST...
class ScrapesController < ApplicationController #require 'app/helpers/scraper' def index @campus = campus_value(params[:campus_value]) @term = set_search_term_value(params[:term_value]) search_results = search(params[:search]) @scraped_courses = Scrape.extract_courses(search_results) end def ...
FactoryGirl.define do factory :recurrence do task auto_schedule false expression "day" next_at "2013-10-19 10:56:03" starting_at "2013-10-19 10:56:03" until_at "2013-10-21 10:56:03" end end
# frozen_string_literal: true require_relative 'inning_mapper.rb' require_relative 'player_mapper.rb' require_relative 'gcm_mapper.rb' module MLBAtBat module Mapper # WholeGame Mapper: MLB API -> WholeGame entity class WholeGame def initialize(gateway_class = MLB::Api) @gateway_class = gateway...
class Robot < ActiveRecord::Base validates_presence_of :facing, :horizontal, :vertical validate :horizontal_and_vertical_cannot_more_than_4 def horizontal_and_vertical_cannot_more_than_4 if !self.horizontal.blank? && !self.vertical.blank? if (self.horizontal > 4 || self.vertical > 4 || self.horizontal...
class TradingStrategy < ApplicationRecord extend Enumerize enumerize :name, in: [:constant, :tier] belongs_to :trader validates_presence_of :name, :max_consecutive_fail_times end
# module Axys class Axys::TransactionsWithSecuritiesReport #< Axys::Report def self.run!(opts) new(opts).run! :remote => true end if $RUN_AXYS_LOCALLY puts "RUNNING AXYS LOCALLY" def run!(opts={}) txns = [] self.attribs = (self.start..self.end).inject({}) do |attribs_to_...
class Detail < ActiveRecord::Base has_and_belongs_to_many :pictures belongs_to :genre end
class FiboEnumerable include Enumerable def initialize(tree) @tree = tree end def each while @tree car,cdr = @tree.call # <--- @tree is a closure yield car @tree = cdr end end end def fibo(a,b) lambda { [a, fibo(b,a+b)] } # <---- this would go into infinite recursion if it w...
module Peanut::RedisModel extend ActiveSupport::Concern include Peanut::Model include ActiveModel::Model include ActiveModel::SerializerSupport attr_accessor :fetched included do def self.pipelined_find(ids) return [] if ids.blank? attrs = redis.pipelined do ids.map{ |id| redis.h...
class StorySerializer < ActiveModel::Serializer attributes :id, :title, :genre, :description, :team, :next_public has_many :contributors has_many :submissions end
class Person attr_reader :age attr_accessor :name def initialize(name, age) @name = name self.age = age end def age= (new_age) @age ||=5 #default value; only sets to 5 for the first time @age = new_age unless new_age > 120 end end person1 = Person.new("Ray", 130) puts person1.age person1.age = 10 puts p...
class PrepCoursesController < ApplicationController before_action :set_prep_course, only: [:show, :edit, :update, :destroy] # GET /prep_courses # GET /prep_courses.json def html end def javascript end def ruby end def git end def login end def index @users = User.all end def ...
Rails.application.routes.draw do devise_for :users resources :posts resources :profiles, only: [:show, :new, :edit, :update, :create] root 'welcome#index' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
# frozen_string_literal: true module Admin class SessionsController < ApplicationController def create user = User.find_by!(email: params[:email]) if user.authenticate(params[:password]) jwt_service = JWTService.new(user_id: user.id) response.set_cookie(*jwt_service.cookie) ...
class CheckoutController < ApplicationController def create @order = "#{current_cart.id} created at #{current_cart.created_at}" # Amount in cents @price_in_dollars = current_cart.subtotal @price_in_cents = (@price_in_dollars * 100).to_i customer = Stripe::Customer.create( :email => params[:...
## # Copyright 2017-2018 Bryan T. Meyers # # 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 to in w...
# frozen_string_literal: true class NestedFieldTest include Mongoid::Document field :title, type: String belongs_to :field_test, inverse_of: :nested_field_tests belongs_to :another_field_test, inverse_of: :nested_field_tests include Mongoid::Timestamps has_many :deeply_nested_field_tests, inverse_of: :ne...
class Researchers::ConfirmationsController < Users::ConfirmationsController def show super @referrer_options = Researcher.referrer_options end def update @researcher = User.find_by_confirmation_token! params[:researcher][:confirmation_token] @researcher.update(confirmation_params) if @rese...
require 'r18n-core' require 'pathname' module Rack class R18n # Avaible options: # :default => en # :place => "i18n" # Note: This is relative to #root attr_reader :options, :place def initialize(app, options = {}) @app = app @options = options ::R18n::I18n.default = @option...
require 'rails_helper' RSpec.describe AdminArea::CardRecommendations::Complete do let(:admin) { create_admin } let(:op) { described_class } let(:account) { create_account(:eligible) } let(:person) { account.owner } example 'success - no note, no rec request' do result = op.( { person_id: person.i...
require 'euler_helper.rb' NAME ="How many different ways can one hundred be written as a sum of at least two positive integers?" DESCRIPTION ="How many different ways can one hundred be written as a sum of at least two positive integers?" def c n count n,n-1 end def count n, k, memo = {} memo[[n,k]] ||= if k == 2...
require "launch/test_helper" describe "launch_service" do before do @job = Launch::Job.new @job.label = "org.launch.test" @job.environment_variables = ENV.to_hash @job.program_arguments << Gem.ruby @job.program_arguments << "-e" @job.program_arguments << <<-PROGRAM requrie "rubygems" ...