text
stringlengths
10
2.61M
class ProblemsController < ApplicationController def index if params[:search] @problems = (Problem.search(params[:search])) #+Problem.tagged_with(params[:search])).uniq elsif params[:tag] @problems = Problem.tagged_with(params[:tag]) else @problems = Problem.all.order('created_at DESC'...
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html get '/admin' => 'exchange_rates#edit' patch '/admin' => 'exchange_rates#update', as: 'exchange_rate' root 'exchange_rates#index' end
require 'test_helper' class CreateProductEditTest < ActionDispatch::IntegrationTest def setup @json = {shopper_name: 'bob', variant_id: 4294967296, product_id: 4294967296, image_source: '', title: 'Title', description: 'Description', aisle: 'aisle', title_new: 'Title', description_new: 'Description', aisle_new:...
class RigidMotions attr_reader :rotation, :horizontal_reflection def initialize(rotation, horizontal_reflection) @rotation = rotation @horizontal_reflection = horizontal_reflection end end class RigidMotionDictionary attr_reader :ordered_list, :hash, :number_of_symbols def initialize(hash) @order...
module CamaleonCms class UserRoleDecorator < CamaleonCms::ApplicationDecorator include CamaleonCms::CustomFieldsConcern delegate_all def the_title object.name.to_s.translate(get_locale) end def the_content object.description.to_s.translate(get_locale) end end end
class EventOrganizer < ActiveRecord::Base attr_accessible :event_id, :user_id validates_presence_of :event_id, :user_id validates_uniqueness_of :user_id, scope: :event_id belongs_to :event belongs_to :user end
require "thor" require 'json' # require 'samwise' module Samwise class Cli < Thor method_option :infile, :aliases => "-i", :desc => "Nonpiped version input" # method_option :dunsnum, :aliases => "-d", :desc => "DUNS number" desc "verify", "Verify DUNS numbers are in SAM.gov" def verify wrap_sa...
Puppet::Type.newtype(:glusterfs_vol) do desc 'Native type for managing glusterfs volumes' ensurable do defaultto(:present) newvalue(:present) do provider.create end newvalue(:absent) do provider.destroy end end newparam(:volume, :namevar=>true) do desc 'Volume name' new...
require 'spec_helper' describe StudentGrades::StudentCollection do let(:students) { [ double(grade_average: 88) ] } subject(:student_collection) { StudentGrades::StudentCollection.new } before { student_collection.students = students } describe '#add' do let(:new_student) { double(grade_average: 78) } ...
require 'spec_helper' describe Winery do describe "#wines_count" do before(:each) do @wine = create(:wine) @winery = @wine.winery end it "should increment if create" do Winery.find(@winery).wines_count.should be(1) end it "should decrement if destroy" do @wine.destroy ...
class Region < ActiveRecord::Base self.pluralize_table_names = false has_many :games has_many :accessories end
require "conduit/sureaddress/parsers/base" module Conduit::Driver::Sureaddress class VerifyAddress::Parser < Parser::Base attribute :client_number do string_path("/AddressResponse/ClientNumber/text()") end attribute :business_unit do string_path("/AddressResponse/BusinessUnit/text()") en...
# frozen_string_literal: true module J8 module Common module_function def initialize(callable = nil, &block) @callable = callable_from_proc(callable, block) end def lambda?(o) o.is_a?(Proc) && o.lambda? end def raise_unless_lambda(o) return if lambda?(o) raise Argu...
# frozen_string_literal: true require 'open-uri' module NZWhois # # Client used to fetch NZ WHOIS data and delegate parser results # class Client extend Forwardable # # Class helper for whois instance method # @param [String] domain Domain name to fetch WHOIS data for # @return Client ins...
class Item < ApplicationRecord scope :available_items, -> {where(:is_reserved => false)} belongs_to :item_type, counter_cache: true validates_presence_of :item_type validates_inclusion_of :is_reserved, :in => [true, false] before_validation do if self.is_reserved.nil? self.is_reserved = false ...
class Autocomplete include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming def initialize params = {} @term = params[:term] @number_of_results = params["limit"] ? params["limit"].to_i : 5 @type = params["type"] end def results return [] if @term == "" ...
RSpec.describe Board::Board do BOARD_SIZE = 3 board = Board::Board.new(BOARD_SIZE) describe "#addValue" do it "The cell number no exists" do expect(false).to eq(board.addValue(25,0)) expect(false).to eq(board.addValue(0,0)) end it "The cell number exists" do expect(true).to eq(board.addValue(1,1)) ...
class Subscription attr_reader :id, :billing, :start_period, :end_period def initialize(attrs = {}) @id = attrs["customer"] @billing = attrs["billing"] @start_period = Time.at(attrs["current_period_start"]).strftime("%B %e, %Y") @end_period = Time.at(attrs["current_period_end"]).strftime("%B %e, %Y"...
class Book attr_reader :title, :author, :publication_year def initialize(book_info) @title = book_info[:title] @author = book_info.values[0..1].join(' ') @publication_year = book_info.[:publication_date].split(' ').last # @publication_year = book_info.[:publication_date][-4..-1] end end
class Preference < ActiveRecord::Base validates :artist_sort_order, :song_sort_order, inclusion: { in: %w(ASC DESC) } validates :allow_create_artists, :allow_create_songs, inclusion: { in: [true, false] } end
require 'setup_tests' class OptionsTest < Test::Unit::TestCase context 'the options for a Target' do setup do @options = Options.new end should 'be modifiable via the options hash' do @options[:auto_scrub_data] = false @options[:credentials] = [{:user=>'someuser'}] @options[:prof...
require "colorize" # require "byebug" class Tile def initialize(pos, board) @pos = pos @board = board @revealed = false @is_bomb = false @flagged = false @cheating = true end def inspect { "pos" => @pos, "revealed" => @revealed, "is_bomb" => @is_bomb, "flagge...
require "highline" module PasswordPromptHelpers # This password matches the testing users available on dev machines def default_test_password "N:B3e%7Cmh" end # Intercepts HighLine prompting for a password and returns the testing default # or a specific value. Otherwise this blocks the specs. # def ...
#crying_baby.rb (main file) # Necessary order to get baby to stop crying: # change # rock # feed #require files for module of methods require "./crying_baby_modules.rb" include CryingBabyMethods puts <<END " ___ ____ _ _ __ __ _ ___ ____ __ ____ _ _ ___ __ _ _ ____ / __)( _ ...
require File.expand_path("../../app/path_provider.rb", __FILE__) describe NBConfiguration do let(:including_class) do Class.new do include NBConfiguration end end describe "nb_api_token" do it "returns ENV['NB_API_TOKEN']" do ENV['NB_API_TOKEN'] = 'abc' object = including_class.new...
require 'byebug' require_relative 'tile.rb' class Board attr_accessor :grid def self.default_grid Array.new(9) { Array.new(9) } end def initialize(num_of_bombs) @grid = Board.default_grid populate place_bombs(num_of_bombs) end def populate # @grid.flatten.map { |space|} @grid.ea...
Rails.application.routes.draw do devise_for :users, :controllers => {registrations: 'registrations'} # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html authenticated :user do get '/', to: "medias#index" get '/about', to: "homes#index" post '/update_p...
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{twiq} s.version = "0.0.0" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_ruby...
class DruggistMailer < ActionMailer::Base default to: Proc.new { User.where("role = 'druggist'").pluck(:email) }, from: "klinikmedifast@gmail.com" def order_admin_confirmation(order) @user = order mail(subject: "Новый заказ") end end
#!/usr/bin/env ruby #RomanNumerals in Ruby #DS 2014-00-00 #If using IronRuby, from command line: #ir RomanNumerals.rb #see also: # http://codequizzes.wordpress.com/2013/10/27/converting-an-integer-to-a-roman-numeral/ # http://codequizzes.wordpress.com/2013/10/27/converting-a-roman-numeral-to-an-integer/ #...
#Fedena #Copyright 2011 Foradian Technologies Private Limited # #This product includes software developed at #Project Fedena - http://www.projectfedena.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 ...
require 'ostruct' require 'persist' module Plugins # Forecast is a Cinch plugin for getting the weather forecast. # @original_author Jonah Ruiz <jonah@pixelhipsters.com> # @author Liothen <liothen@flagrun.net> class Weather include Cinch::Plugin include Cinch::Helpers enable_acl set( p...
Cfp::Engine.routes.draw do root :to => "proposals#index" resource :profile resources :proposals do resources :comments resources :ranks, :only => [ :create ] end end
class MainMenuController < ApplicationController def index @cardinal_functions = {"Inventory" => [["PCT", "Allows ability to change the quantity count on a pallet"], ["PDL", "Delete a pallet's inventory."], ["PLO", "Load new product to an existing tag or new tag."], ...
class CreateTournaments < ActiveRecord::Migration def change create_table :tournaments do |t| t.string :title, null: false, default: "" t.text :description, null: false, default: "" t.string :tournament_type, null: false, default: "swiss" t.datetime :tournament_...
class Plan PRICES = { bulk: 0, public: 0, private: 12 } TYPES = { bulk: 'bulk', public: 'public', private: 'private' } def initialize(repo) @repo = repo end def type if @repo.bulk? TYPES[:bulk] elsif @repo.private? TYPES[:private] else TYPES[:pu...
class Parrot attr_accessor :name attr_accessor :age def initialize name, age @name = name @age = age end def repeat_phase phase = 'Curupaco' "#{@name} say: #{phase}!!" end end louro = Parrot.new 'Louro', 2 louro.name = 'Louro José' puts louro.repeat_phase puts ...
class Instructors::GroupsController < Instructors::ApplicationController before_filter :find_group, :only => [:show, :edit, :update, :destroy] cache_sweeper :group_sweeper, :only => [:create, :update, :destroy] add_crumb("Classes") { |instance| instance.send :instructors_classes_path } subject_buttons ...
require_relative '../spec_helper' describe 'API' do include Rack::Test::Methods describe 'game' do let!(:token) { create(:token) } describe 'POST /game' do describe 'with a valid token' do before { post '/game', params={token: token.token} } subject { last_response } it { is...
FactoryBot.define do factory :lecture_timestamp do title { "MyString" } description { "MyText" } seconds_from_start { 1 } public { false } end end
# Given a string, write a function to check if it is a permutation of a palindrome. # A palindrome is a word or phrase that is the same forward or backwards. A # permutation is a rearrangement of letters. The palindrome does not need to be # limited to just dictionary words. def palindrome_perm?( str ) letter_hash...
# frozen_string_literal: true module Rabbitek module Utils ## # OpenTracing helpers class OpenTracing OPENTRACING_COMPONENT = 'rabbitek' OPENTRACING_KIND_SERVER = 'server' OPENTRACING_KIND_CLIENT = 'client' class << self def inject!(span, carrier) ::OpenTracing....
class JobsController < ApplicationController respond_to :json def show respond_with job end def create job.save! job_handler.queue_processing(requested_format) respond_with job end private def job @job ||= if job_id = job_params[:id] Job.find(job_id) else ...
class CreateMembers < ActiveRecord::Migration def change create_table :members do |t| t.string :name t.string :title t.datetime :joined t.text :join_reason t.string :function t.string :first_computer t.string :any_other_comments t.references :gallery, index: true ...
describe "RuntimeTable" do subject(:runtime_table) do require __FILE__.sub('/spec/', '/').sub('_spec.rb', '.rb') RuntimeTable.new end let(:people_s_table) { RuntimeTable.new [{name: "John", age: 22}, {name: "Ana", age: 22}] } let(:johns_row) { RuntimeTable::Row.new name: "John", age: 22 } let(:row) { ...
require 'active_support/core_ext/hash' require 'active_support/core_ext/object/blank' module Topographer class Importer class Mapper class FieldMapping attr_reader :input_columns, :output_field def initialize(required, input_columns, output_field, &mapping_behavior) @required = r...
class V1::PasswordsController < ApplicationController before_action :require_login , except: [ :forgot , :recover ] def forgot if !email = params[:email] return render json: {error: 'Email not present'} end # @company = ::Company.find_by( # email.include?("@") ? { email: email } : { usernam...
# frozen_string_literal: true module Knuckles module Stages # The combiner stage merges all of the individually rendered results into a # single hash. The output of this stage is a single object with string keys # and array values, ready to be serialized. module Combiner extend self # Me...
require 'fluent/log' require 'json' module Fluent class TextParser class WithExtraFieldsParser < Parser Plugin.register_parser('with_extra_fields', self) config_param :base_format, :string config_param :suppress_parse_error_log, :bool, :default => false def initialize super ...
# verions_helper_patch.rb # ########################### ## ## As modificações aqui visam buscar as tarefas pai das tarefas na versão ##### module RedmineSubtasks::Patches module VersionsHelperPatch def self.included(base) base.send(:include, InstanceMethods) base.class_eval do ...
module Inventory class UpdateMetrcTagsReported prepend SimpleCommand def initialize(args = {}) args = { facility_id: nil, metrc_tags: [], }.merge(args) raise ArgumentError, 'facility_id is empty' if args[:facility_id].nil? @facility_id = args[:facility_id]&.to_bson_i...
## # Resource Presentation 是 DOSSER 风格的资源表现逻辑的关注点。 # HTTP 状态码可参考以下链接: # https://httpstatuses.com/ # http://www.restapitutorial.com/httpstatuscodes.html # http://guides.rubyonrails.org/layouts_and_rendering.html#the-status-option module Repres::Dosser::Concerns::ResourcePresentation extend ActiveSupport::Concern ...
class Orderitem < ActiveRecord::Base belongs_to :weeklydfcorder belongs_to :item validates_uniqueness_of :item_id, :scope => :weeklydfcorder_id QTYS = ["mon", "tue", "wed", "thu", "fri"] DATES = ["mondate", "tuedate", "weddate", "thudate", "fridate"] CHARGES = ["moncharge", "tuecharge", "wedch...
# -*- encoding : utf-8 -*- class AddNameToFields < ActiveRecord::Migration def change add_column :fields, :name, :string remove_index(:fields, column: [:church_id, :applies_to]) add_index :fields, [ :church_id, :applies_to, :name ], unique: true end end
require 'spec_helper' describe FlipTheSwitch::Generator::Category do subject(:category) { described_class.new(output, feature_states) } let(:output) { 'spec/resources' } let(:feature_states) { {'first_feature' => true, 'second_feature' => false} } let(:expected_header_file) { File.read('spec/resources/expected...
class SkillLevelsController < ApplicationController before_action :set_skill_level, only: [:show, :edit, :update, :destroy] # GET /skill_levels # GET /skill_levels.json def index @skill_levels = SkillLevel.all end # GET /skill_levels/1 # GET /skill_levels/1.json def show end # GET /skill_leve...
require 'spec_helper' require_relative '../../models/good.rb' RSpec.shared_examples 'An Exempt' do describe 'Tax' do it { expect(object.tax_amount).to eql(0.0) } it { expect(object.type).to eql(Tax::EXEMPT) } it { expect(object.tax_rate).to eql(Tax::EXEMPT_RATE) } it { expect(object.tax_rate).to eql(...
require 'faker' FactoryGirl.define do factory :invoiced_item do invoice_id { FactoryGirl.create(:invoice).id } product_id { FactoryGirl.create(:product).id } product_code 'ABC' product_name 'OATS' qty 10 commodity_cost 10 packaging_cost 2 labour_cost 12 unit_cost 3 unit_price ...
# frozen_string_literal: true require 'aws-sdk-cognitoidentityprovider' require 'cernight/reserved_attributes' module Cernight class User extend Cognito attr_reader :username def initialize(username, attrs = []) @username = username @attrs = convert_attributes_to_hash(attrs) @attrs....
require 'fileutils' module OggEncode class Flac < File def self.exists?( path ) file?( path ) and basename( path ) =~ /\.flac$/ end end class Ogg < File def self.exists?( path ) file?( path ) and basename( path ) =~ /\.ogg$/ end end class SizedPsHash < Hash def initialize...
require File.join(File.dirname(__FILE__), '../iis/iis_object') Puppet::Type.type(:iis_errorpages).provide(:iis_errorpages, :parent => Puppet::Provider::IISObject) do desc "IIS Error Pages" confine :operatingsystem => :windows defaultfor :operatingsystem => :windows commands :appcmd => File.join(ENV['Sys...
class Hangman INITIAL_CHANCES = 8 HIDDEN_CHARACTER = '_' class GameOverException < Exception ; end attr_reader :chances, :guesses def initialize(word_generator = RandomWordGenerator.new) @chances = INITIAL_CHANCES @guesses = [] @word = word_generator.random_word end def word if @guesse...
EMAIL_REGEX = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/ class User < ActiveRecord::Base has_secure_password validates_presence_of :name validates_format_of :email, with: EMAIL_REGEX validates_uniqueness_of :email def self.find_by_email_and_authenticate options={} return unless user ||= User.find_by_e...
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). # # Examples: # # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) # Ch...
# frozen_string_literal: true require 'simplecov' SimpleCov.start require 'minitest/autorun' require 'minitest/emoji' require './lib/sales_engine' # Sales engine test class SalesEngineTest < Minitest::Test def setup merchant1 = { id: 1, name: 'Bonos', created_at: '2010-12-22', updated_at: '2010-12-24' } me...
FactoryGirl.define do factory :user, class: User do sequence(:name) {|n| "test#{n}" } sequence(:login) {|n| "test#{n}" } sequence(:mail) {|n| "test#{n}@example.com" } section { create(:section) } authority 2 password "password" password_confirmation "password" end factory :section_use...
require 'spec_helper' require 'pry' require_relative '../heap' describe 'Heap' do let!(:heap) { Struct.new(:url, :counter) } let!(:max_heap) { Heap.new :> do |a, b| a.counter == b.counter ? (a.url < b.url) : (a.counter > b.counter) end } it 'returns max element from heap' do max_heap.add heap.new...
# frozen_string_literal: true FactoryBot.define do factory :room do name { generate(:room_name) } description { Faker::Lorem.sentences } seats { 3 } end end
class User < ActiveRecord::Base validates :email_address, uniqueness: true validates_confirmation_of :password has_many :links has_secure_password end
module SpreeSkrillRecurring class ApplicationController < ActionController::Base private def recurring_params params.require(:recurring).permit(:preferred_merchant_id, :preferred_language, :preferred_currency, :preferred_payment_options, :preferred_server, :preferred_test_mode) end end end
class Prescription < ActiveRecord::Base belongs_to :patient attr_accessible :dosage, :drug_id, :patient_id, :quantity, :third_party, :price def update_quantity(qty) qty_diff = qty - self.quantity drug = Drug.find(self.drug_id) drug.decrease_quantity(qty_diff) price = drug.price_per_unit * qty ...
# == Schema Information # # Table name: events # # id :integer not null, primary key # date :date # time :time # location :string # user_id :integer # sherpa_id :integer # game_id :integer # created_at :datetime not null # updated_at :datetime not null # c...
class AddVersionedIbt < ActiveRecord::Migration def self.up Ibt.create_versioned_table end def self.down Ibt.drop_versioned_table end end
require 'rspec' require 'deck' require 'card' require 'set' describe 'Deck' do subject(:deck) { Deck.new } describe '#initialize' do it 'has 52 cards' do expect(deck.cards.count).to eq(52) end it 'has 13 of each suit' do expect(deck.cards.select{|x| x.suit == Suit.suit("DIAMOND")}.length)...
FactoryGirl.define do factory :user, aliases: [:inviter, :invitee] do first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } email { Faker::Internet.email(name) } password "testing123" end end
class CreateSales < ActiveRecord::Migration def change create_table :sales do |t| t.float :discount t.boolean :active, default: true t.string :discount_type t.timestamps null: false end end end
require File.dirname(__FILE__) + '/../../spec_helper' describe "/favoritos/show.html.erb" do include FavoritosHelper before(:each) do @favorito = mock_model(Favorito) @favorito.stub!(:titulo).and_return("MyString") @favorito.stub!(:enlace).and_return("MyString") assigns[:favorito] = @favorito ...
class AgentRegressionChecksController < ApplicationController before_action :set_owner before_action :set_agent before_action :check_user_rights before_action :set_regression_check, only: [:update, :destroy] rescue_from ActiveRecord::RecordNotFound, with: :record_not_found def create @regression_check...
class StudentWorkshop < ApplicationRecord belongs_to :user belongs_to :workshop has_many :request_answers validates :workshop, :user, presence: true def badge_status if status == "pending" return "badge-info" elsif status == "accepted" return "badge-success" elsif status == "rejected" retur...
class Bridge COMPONENTS = INPUT.split("\n").map { |l| l.split("/").map(&:to_i) } def initialize(components = [], open_port = 0) @components = components @open = open_port end def extended_with(component) Bridge.new( @components + [component], (component[0] == @open) ? component[1] : co...
class Role < ActiveRecord::Base belongs_to :user belongs_to :allowable, :polymorphic => true validates_uniqueness_of :role_type, :scope => [:user_id, :allowable_id, :allowable_type], :message => "Access right for this Role and Project already exists" module Type SUPER_ADMIN = "super_admin" CLIENT_...
module Lgame Treasure = Struct.new(:name, :points) module TreasureTrove TREASURES = [ pie = Treasure.new("pie", 5), bottle = Treasure.new("bottle", 25), hammer = Treasure.new("hammer", 50), skillet = Treasure.new("skillet", 100), bromstick = Treasure.new("bromstick", 200), ...
FactoryBot.define do factory :care_type do sequence(:name) { |n| "test_care_type#{n}"} end end
class Relationship < ActiveRecord::Base attr_accessible :followed_id belongs_to :follower, class_name: "User" belongs_to :followed, class_name: "User" #this class belongs to 2 users, the followed (source: followed_id ie "followed") #and the follower (source: follower_id ie "follower") validates :foll...
# frozen_string_literal: true class User < ApplicationRecord validates :name, presence: true validates :birthday, presence: true validates :product_team_id, presence: true validates :point, presence: true validates :role_id, presence: true validates :join_date, presence: true belongs_to :role belongs_...
# frozen_string_literal: true class GenericMailer < ApplicationMailer default from: %("NUSSU commIT" <duty@#{ENV['MAILGUN_DOMAIN']}>) def drop_duties(duties, user_ids) @from = duties.first.user.username @date = duties.first.date # Prevent (n + 1) queries @times = process_duties_times( Duty.i...
class Renametocreatorid < ActiveRecord::Migration[6.0] def change change_table :events do |t| t.rename :users_id, :creator_id end end end
class AkayagiController < ApplicationController def save project = Project::find(params[:project_id]) begin @settings = AkayagiProjectSettings::find_or_create_by(project_id: project.id) @settings.subject_prefix = params[:subject_prefix] @settings.from_address = params[:from_address] @...
class Show < ActiveRecord::Base def self.highest_rating best = Show.order(rating: :desc).limit(1) best[0][:rating] end def self.most_popular_show best = Show.order(rating: :desc).limit(1) best[0] end def self.lowest_rating worst = Show.order(rating: :asc).limit(1) worst[0][:rating] ...
class Category < ActiveRecord::Base attr_accessible :name, :description validates :name, presence: true, uniqueness: true validates :description, presence: true has_many :product_categories, dependent: :destroy has_many :products, through: :product_categories end
class AddOrdernumToBookMalls < ActiveRecord::Migration def self.up add_column :book_malls, :order_number, :integer, :default => -1 end def self.down remove_column :book_malls, :order_number end end
class EmployeeMaster < ActiveRecord::Base validates_presence_of :emp_name validates_uniqueness_of:emp_name acts_as_nested_set belongs_to :designation belongs_to :department has_many :leave_managements has_many :events has_many :resumes, :dependent => :destroy has_many :educations, :dependent => :...
require 'rails_helper' RSpec.describe 'Owner model additions' do %w{User Company}.each do |main_app_user_class| describe "with main app user #{main_app_user_class}" do before :each do @main_app_user = Object.const_get(main_app_user_class).create! @user = Referrer::User.create! end ...
# @see https://www.planosdesaudetodosaqui.com.br/ health_plans = [ 'ALLIANZ SAÚDE', 'AMEPLAN SAÚDE', 'AMIL SAÚDE', 'BIOSAÚDE', 'BIOVIDA SAÚDE', 'BLUE MED SAÚDE', 'BRADESCO SAÚDE', 'CLASSES LABORIOSAS', 'CRUZ AZUL SAÚDE', 'GS SAÚDE', 'GOLDEN CROSS', 'HEALTH SANTARIS', 'INTERCLINICAS SAÚDE', '...
require File.dirname(__FILE__) + '/spec_helper' describe Petstore::ApiClient do describe '#initialize' do it "should save the message if one is given" do err = Petstore::ApiError.new(message: "Hello") expect(err.message).to eq("Hello") end it "should save the hash as message if no message is...
require_relative('../db/sql_runner.rb') class Role attr_reader :id attr_accessor :actor_id, :movie_id, :fee def initialize(options) @id = options['id'].to_i if options['id'] @actor_id = options['actor_id'].to_i @movie_id = options['movie_id'].to_i @fee = options['fee'] end d...
require 'rails_helper' require_relative 'current_full_forecast_mock' require_relative 'evening_forecast_mock' describe Weather do it 'makes a weather summary' do location = 'Denver,CO' current_forecast = CurrentFullForecastMock.forecast lat_long = '39.7392358,-104.990251' google_location_info = {:lo...
class OrangeTree def initialize @orange_count = 0 @current_height = 1 @current_age = 0 puts "A new orange tree is born!" end def height puts "The tree's current height is #{@current_height}." end def age puts "The tree's current age is #{@current_age}." end def t...
require 'test_helper' class ComputadorsControllerTest < ActionDispatch::IntegrationTest setup do @computador = computadors(:one) end test "should get index" do get computadors_url, as: :json assert_response :success end test "should create computador" do assert_difference('Computador.count'...
require './test_helper.rb' class TestStack < MiniTest::Unit::TestCase def setup @register = Stack.new([5, 6, 7, 8]) end def test_ assert_equal 8, @register.pop assert_equal 7, @register.pop assert_equal true, @register.push([4, 2]) assert_equal [2, 4, 6], @register.pop(3) assert_equal [5...