text
stringlengths
10
2.61M
module ErrorsFormat def fill_model_errors(object) details_hash = object.errors.details error_types = [] error_fields = [] error_messages = slice_full_messages(object.errors.full_messages, details_hash) details_hash.each do |key, value| error_fields << key error_types << value ...
class ChangeUserIdColumnOnCommitsTableToPersonId < ActiveRecord::Migration def change remove_column :commits, :user_id add_column :commits, :person_id, :integer end end
class Shoe < ActiveRecord::Base belongs_to :user has_many :sales has_many :buyers, through: :sales, source: :user validates :product, length: {minimum:2} validates :price, numericality: {only_integer: true, greater_than_or_equal_to:0} end
class ReportsController < ApplicationController before_action :require_admin skip_before_action :require_admin, only: [:new, :create] before_action :interaction_exists skip_before_action :interaction_exists, only: [:index, :create, :show, :update] def index @person = Person.find(params[:person_id]) ...
#!/usr/bin/ruby #require 'rubygems' require 'fileutils' class BWAAlignment def self.fastq_read(name, seq, qual) str = "#{name}\n#{seq}\n+\n#{qual}\n" return str end def initialize(reference, bwa) @random = Time.now.to_i + rand(1000) @ref = reference @bwa_path = bwa end def get_unique_...
# class HeinensScraper < ApplicationRecord # attr_accessor :item, :price, :url, :store # # @@doc = Nokogiri::HTML(open("https://www.aldi.us/en/weekly-specials/")) # # @@store = [] # @@items = [] # @@price = [] # @@url = [] # #def initialize(item = nil, url = nil, price = nil) # # @item = item # # ...
require 'rails_helper' RSpec.describe Order, type: :model do describe '商品購入機能' do before do @order = FactoryBot.build(:order) end it 'すべて値が正しく入力されていれば購入できること' do expect(@order).to be_valid end it 'トークンが生成されないと購入できない' do @order.token = '' @order.valid? expect(@order....
require 'rails_helper' feature 'User delete contact' do scenario 'Successfully' do contact = create(:contact) other_contact = create(:contact, name: 'Jake Peralta', email: 'jakep@nypd.com', phone: '911') user = create(:user) ...
require 'capybara/rspec' class PermissionSettingsPage < SitePrism::Page #region define elements element :submit_button, :xpath, ".//*[@id='permissionsForm']//tr[1]/td/a[@title='Submit']" element :categoryThreadPostPerm_list, :xpath, ".//select[@id='post_perm_nodetype3']" def clickButton(buttonName) case ...
class AddSpotsToCposting < ActiveRecord::Migration def change add_column :cpostings, :spots, :integer end end
# Read about factories at https://github.com/thoughtbot/factory_girl FactoryGirl.define do factory :advertisement do name "MyString" youtube_video_id "MyString" deleted_at "2013-05-23 12:33:14" end end
class CreateUploadFiles < ActiveRecord::Migration def change create_table :upload_files do |t| t.string :xml_file_name t.string :xml_content_type t.string :xml_file_size t.string :xml_updated_at t.timestamps end add_column :conferences, :upload_file_id, :integer add_ind...
class LinkedListNode attr_accessor :value, :next_node def initialize(value, next_node=nil) @value = value @next_node = next_node end end def print_values(list_node) if list_node print "#{list_node.value} --> " print_values(list_node.next_node) else print "nil\n" ...
FactoryBot.define do factory :product do category { "Burgers" } name { "Cheeseburger" } description { "Bun, meat and cheese" } price { 100 } end end
require 'spec_helper' require 'tent-client/cycle_http' describe TentClient::CycleHTTP do let(:http_stubs) { Faraday::Adapter::Test::Stubs.new } let(:server_urls) { %w(http://example.org/tent http://foo.example.com/tent http://baz.example.com/tent) } let(:entity_uri) { server_urls.first } let(:server_meta) { ...
require 'test/unit' require 'lexer' module DebugNodes class Base end class Text < Base def initialize(text) super() @text = text end def to_s @text end end class Transition < Base def initialize(text) super() @text = text end def to_s @text end end class EndState < Base def initialize(state) ...
require 'open-uri' require 'json' class GamesController < ApplicationController def new @letters = ('A'..'Z').to_a.shuffle.take(10) end def score word = params[:word] letters = params[:letters] if word.upcase.split("").all? do |letter| word.upcase.count(letter) <= letters.count(letter) ...
class Console def initialize(input = $stdin, output = $stdout) @input = input @output = output end def print(message) @output.puts message end def prompt(message) @output.puts message @input.gets.chomp end end
require './lib/simulate_helper' subgame1 = Subgame.new subgame1.name = "Packers" subgame1.points = 7 subgame2 = Subgame.new subgame2.name = "Vikings" subgame2.points = 10 subgame3 = Subgame.new subgame3.name = "Bears" subgame3.points = 14 describe "A Subgame" do it "should have a name" do expect(subgame1.n...
# frozen_string_literal: true module Rabbitek ## # A model representing message that consumer receives to process class Message attr_reader :payload, :properties, :delivery_info, :raw_payload # @param [Hash] payload # @param [Bunny::MessageProperties] properties # @param [Bunny::DeliveryInfo] de...
module Fog module Compute class Brkt class Real def create_volume_template(instance_template_id, attributes) request( :expects => [201], :method => "POST", :path => "v1/api/config/instancetemplate/#{instance_template_id}/brktvolumetemplates", ...
class Gym attr_reader :name @@all = [] def initialize(name) @name = name @@all << self end def self.all @@all end def memberships Membership.all.select do |memberships| memberships.gym == self end end def lifters self.memberships.map do |memberships| membership...
#!/usr/bin/env ruby # require some built-in ruby libraries require 'optparse' require 'cgi' require 'net/smtp' # and some gems require 'rubygems' require 'mechanize' require 'highline/import' # reopen the string class and add some header finding methods class String def mail_header(header) matches = match /^#{...
module LoginLogoutHelpers def login_user fetch_visitor user_find_or_create(@visitor) visit '/users/sign_in' fill_in "user_email", :with => @visitor[:email] fill_in "user_password", :with => @visitor[:password] click_button "Sign me in" end def logout_user page.driver.submit :delete, ...
class PickupLocationsController < InheritedResources::Base before_filter :authenticate_user! before_filter :authenticate_owner, :only => [:show, :edit, :update, :destroy] # GET /pickup_locations # GET /pickup_locations.json def index if params[:pickup_location] @pickup_locations = PickupLocation.wh...
require "rci/version" require 'rci/instrumentation' require 'rci/commands' module RCI def self.setup(redis) discover_commands(redis) attach_instrumentation! end def self.attach_instrumentation_to(redis) discover_commands(redis) redis.client.singleton_class.send(:prepend, RCI::Instrumentation) ...
class CreateTimeCards < ActiveRecord::Migration[5.2] def change create_table :time_cards do |t| t.integer :user_id, null: false t.integer :task_id, null: false t.datetime :start_time, null: false t.datetime :end_time t.timestamps end end end
class AddUsernameToUsers < ActiveRecord::Migration[5.1] def change add_column :users, :username, :string add_index :users, :username, name: 'index_users_on_username' remove_columns :users, :reset_password_token, :reset_password_sent_at end end
FactoryBot.define do factory :balance do user points { Faker::Number.number(digits: 3) } country_code { EshopCountries::CODES.sample } after :build do |balance| balance.amount = PointsConverter.convert_to_money(points: balance.points, country_code: balance.country_code) end end end
class CreateCreditCardsTable < ActiveRecord::Migration[5.1] def change create_table :credit_cards do |t| t.integer "user_id", null: false t.string "digits", null: false t.string "brand", null: false t.integer "month", ...
class AddDetailsToProducts < ActiveRecord::Migration[5.1] def change add_column :products, :enabled, :boolean add_column :products, :discount_price, :decimal, precision: 8, scale: 2 add_column :products, :permalink, :string end end
require 'rank_results/rule' module RankResults class Valuator def rules @rules ||= [] end def add_rule(rule) self.rules << rule end def initialize(object) @object = object end def rank rules.inject(0) { |result, rule| result + rule.apply } end end end
class Api::OauthRegistrationsController < ApplicationController before_action :deny_unpermitted_third_party before_action :validate_hash_token! def create if exist_auth_registration? # ログイン user = OauthRegistration.find_by(third_party_id: params[:oauth_registration][:third_party_id],oauth_id: par...
class Subscribe class StripeCharge include Interactor delegate :amount, :author, :subscriber, :card_params, to: :context def call Stripe::Charge.create( amount: amount_cents, currency: "usd", source: card_params, description: description ) rescue Stripe::S...
require "spec_helper" describe VagrantPlugins::Babushka::Provisioner do let(:config) { double "config" } let(:machine) { double "machine", :name => "the name", :communicate => communicate, :env => env } let(:communicate) { double "communicate" } let(:env) { double "env", :ui => ui } let(:ui) { double "ui" } ...
class ListsController < ApplicationController before_action :set_list, :only => [:show,:edit,:update,:destroy,:finished] def index @lists=List.all end def new @list=List.new end def create @list=List.new(list_params) if @list.save redirect_to lists_url else render :action => :new end end ...
class CreateTrackRates < ActiveRecord::Migration def change create_table :track_rates do |t| t.string :tracking_object_type t.integer :tracking_object_id t.string :tracking_service t.integer :send_count, default: 0 t.integer :open_count, default: 0 t.integer :open_percent, defa...
class Comment < ActiveRecord::Base attr_accessible :content, :question_id, :user_id, :parent_id validates :content, :question_id, :user_id, presence: true belongs_to( :user, class_name: "User", foreign_key: :user_id, primary_key: :id, inverse_of: :comments ) belongs_to( :quest...
require 'spec_helper' describe IssueTrackers::GitlabTracker do it "should create an issue on Gitlab with problem params" do notice = Fabricate :notice tracker = Fabricate :gitlab_tracker, :app => notice.app problem = notice.problem number = 5 @issue_link = "#{tracker.account}/#{tracker.project_i...
# frozen_string_literal: true require 'rails_helper' RSpec.describe Comment, type: :model do it { should validate_presence_of(:content) } describe 'scopes' do let(:user) { create(:user) } let(:test_case) { create(:case) } let(:comments) { Comment.all } before(:each) { 3.times { |n| test_case.co...
class Robot attr_reader :id, :name, :city, :birth_date, :date_hired, :department def initialize(data) @id = data[:id] @name = data[:name] @city = data[:city] @birth_date = data[:birth_date] @date_...
# encoding: utf-8 #Credit for this goes to https://github.com/julescopeland/Rails-Bootstrap-Navbar require 'spec_helper' require 'action_view' require 'active_support' require_relative '../../../app/helpers/navbar_helper' include ActionView::Helpers include ActionView::Context include NavbarHelper describe NavbarHelp...
# encoding: utf-8 # Copyright 2014 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 applic...
require 'open3' module Configrr module Exec def self.cmd(command, opts={}) opts = { exit_on_error: true, acceptable_exit_codes: [0], }.merge!(opts) cmd_result = { output: String.new, exit_code: nil, } begin Open3.popen2e(*command) do |stdin...
# 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 rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
require 'erb' module Rtsung ; end class Rtsung::Config attr_accessor :settings, :file def defaults @defaults ||= { :max_users => 800, :duration => 30, :rate => 0.1, :name => 'attack', :requests => [] } end def initialize(&block) @settings = {} @settings.merge!(...
require 'sip' # A model for constructing a DAITSS ingest SIP from a TIPR package describe SIP do before do @sip_path = File.join '..', 'TIPR-IP', 'M2', 'data' @sip = SIP.new @sip_path end it "should be initialized from a TIPR tipr.xml file" do lambda { SIP.new @sip_path }.should_not raise_erro...
class BooksController < ApplicationController def index @user = decorate User.find(params[:user_id]) end end
class ChangedContestTasksAddedRating < ActiveRecord::Migration def self.up add_column :contest_tasks, :rating, :integer end def self.down remove_column :contest_tasks, :rating end end
require File.dirname(__FILE__) + '/../../../spec_helper' describe 'Rackspace::Servers.list_images' do describe 'success' do it "should return proper attributes" do actual = Rackspace[:servers].list_images.body actual['images'].should be_an(Array) image = actual['images'].first image['id'...
# Write a program that requests two integers from the user, adds them together, and then displays the result. Furthermore, insist that one of the integers be positive, and one negative; however, the order in which the two integers are entered does not matter. # Do not check for the positive/negative requirement until ...
# 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...
class BooksController < ApplicationController before_action :set_book, only: [:show, :edit, :update, :destroy] before_action :set_info, only: [:borrow_by_isbn] # GET /books # GET /books.json def index @books = Book.all end # GET /books/1 # GET /books/1.json def show end # GET /books/new d...
class Post < ActiveRecord::Base has_and_belongs_to_many :tags validates :title, :presence => true validates :content, :presence => true end
# frozen_string_literal: true describe Zafira::Models::Environment::Builder do let(:yaml_data) do { # required params 'zafira_api_url' => 'zafira_api_url', 'zafira_access_token' => 'access_token', 'zafira_project_name' => 'project_name', 'test_suite_config_file' => 'suite_config_fil...
require File.dirname(__FILE__) + '/../test_helper' class NodeTagTest < ActiveSupport::TestCase api_fixtures def test_tag_count assert_equal 7, NodeTag.count node_tag_count(:visible_node, 1) node_tag_count(:invisible_node, 1) node_tag_count(:used_node_1, 1) node_tag_count(:used_node_2, 1) ...
class AddColumnAudioToPalabras < ActiveRecord::Migration def change add_column :palabras, :audio, :string end end
class ChangeColumnInThemes < ActiveRecord::Migration[5.2] def change rename_column :themes, :email, :description change_column :themes, :description, :text end end
class AddDefaultValueForIgnoreFields < ActiveRecord::Migration def change change_column :plantings, :ignore, :boolean, :default => false change_column :maintenance_records, :ignore, :boolean, :default => false change_column :notes, :ignore, :boolean, :default => false change_column :adoption_requests,...
# frozen_string_literal: true def with_retry(opts = {}, &block) retries = opts[:retry] || 3 retry_wait = opts[:retry_wait] || 1 tries = 0 begin yield rescue RSpec::Expectations::ExpectationNotMetError => e sleep retry_wait tries += 1 retry if tries <= retries raise e end end describe "...
class AgentsController < ApplicationController before_action :set_owner_and_agent, except: [:index, :new, :create] before_action :check_user_rights, except: [:index, :new, :create] def index @search = AgentSearch.new(current_user, search_params) @total_count = Agent.search(@search.options).count @age...
module Torque module PostgreSQL class AuxiliaryStatement class Settings < Collector.new(:attributes, :join, :join_type, :query, :requires, :polymorphic, :through) attr_reader :base, :source alias_method :select, :attributes alias_method :cte, :source delegate :rel...
# frozen_string_literal: true WITHDRAWAL_AMOUNT = 3 DEPOSIT_AMOUNT = 10 YEAR = 2021 MON = '02' DAY_1 = '08' DAY_2 = '09' DESIRED_OUTPUT = <<~STATEMENT date || credit || debit || balance #{DAY_2}/#{MON}/#{YEAR} || || #{WITHDRAWAL_AMOUNT}.00 || #{DEPOSIT_AMOUNT - WITHDRAWAL_AMOUNT}.00 #{DAY_1}/#{MON}/#{YEAR} || #{...
# The Smalltalk product, upon which MagLev is based, comes with a simple # code and statistics browser written in Smalltalk. This ruby script # registers that code into the Ruby namespace, and then starts the # application. Once it is running, it will print a URL to connect to. # Register the Smalltalk WebTools ...
# frozen_string_literal: true module Main module Actions module Contact class Send < Main::Action before :deserialize, :validate include Deps[ 'mailers.contact_mailer', failure_view: 'views.contact.show' ] params do required(:contact).schema d...
class Task < ApplicationRecord extend FriendlyId friendly_id :name, use: :slugged validates_presence_of :name, :context_id, :priority_id, :project_phase_id, :review_period_id, :status_id belongs_to :project_phase belongs_to :context belongs_to :priorit...
# => Author:: Valentin, DanAurea # => Version:: 0.1 # => Copyright:: © 2016 # => License:: Distributes under the same terms as Ruby ## ## Classe permettant de créer un contrôleur pour la vue FenetreStatistiques ## class StatistiquesControleur < Controller ## ## Initialize ## def initi...
Deface::Override.new(:virtual_path => "spree/admin/taxonomies/_form", :name => "add_info_to_taxonomies", :insert_bottom => "[data-hook='admin_inside_taxonomy_form']", :partial => "spree/admin/taxonomies/extra_info", :disabled => false)
FactoryGirl.define do factory :user do login 'John' password 's3cr3t' password_confirmation 's3cr3t' role :visitor factory :root do role :admin end end end
class Candy < ApplicationRecord belongs_to :shop belongs_to :shelf, counter_cache: true, optional: true end
FactoryBot.define do factory :user do name { Faker::Name.unique.name[1..10] } password { "$2a$12$x9NXHNv4GY/11FVhqjmT/ObkTmund.GigvaOWR8QLCGlFQVTLkeWO" } email { Faker::Internet.unique.email } point { Faker::Number.number(digits: 3) } position { "user" } end end
Rails.application.routes.draw do devise_for :users root "application#home" end
class FontProzaLibre < Formula version "1.0" sha256 "cbd3bb929d905330ad9e2d4b2efc3edf5c351eb5b4a238bd87367e74836fa9c9" url "https://github.com/jasperdewaard/Proza-Libre/archive/#{version}.zip" desc "Proza Libre" homepage "https://github.com/jasperdewaard/Proza-Libre" def install parent = File.dirname(Di...
class ModifyRequestedStore < ApplicationModel belongs_to :user validates_presence_of :name, :address, :lat, :lng, :user_id, :store_id end
Puppet::Type.newtype(:razor_broker) do ensurable newparam(:name, :namevar => true) do desc "The name of the broker; used internally by Razor to identify the broker" end newproperty(:type) do desc "The broker type for this broker (must be in Razor's broker path)" end newproperty(:configuration) do...
class Declaration < ActiveRecord::Base def to_localized lang if lang == 'en' then { :id => self.id, :name => self.name, :title => (self.title_en.blank? ? self.title : self.title_en), :body => (self.body_en.blank? ? self.body : self.body_en) } else { :...
class Grammar N = /[A-Z]/ T = /[a-zλ]/ RULE = /^(?<left>[a-z]+)->(?<right>[a-zλ]+(\|[a-zλ]+)*)$/i LEFT_REGULAR_RULE = /^#{N}->(#{N}#{T}|#{T})(\|(#{N}#{T}|#{T}))*$/ RIGHT_REGULAR_RULE = /^#{N}->(#{T}#{N}|#{T})(\|(#{T}#{N}|#{T}))*$/ attr_accessor :rules def initialize(lines) @lines = lines @rules ...
class Api::V1::ProjectsController < ApplicationController def details @color = Color.find_by(id: params[:id]) unless color render json: {error: "your color was not found"}, status: 404 return end render json: ingredient end def add_color @project = Project.find_by(id: params...
class Account include PageObject page_url("#{BASE_URL}/my-account") h1(:header, :css => '.my-account-title') link(:overview, :css => '.js-tabbed-list .icn-grid') link(:bag, :css => '.js-tabbed-list .icn-shopping-bag') link(:faves, :css => '.js-tabbed-list .icn-star') link(:orders, :css => '.js-tabbed-li...
require "logstash/codecs/json_lines" require "logstash/event" require "insist" describe LogStash::Codecs::JSONLines do subject do next LogStash::Codecs::JSONLines.new end context "#decode" do it "should return an event from json data" do data = {"foo" => "bar", "baz" => {"bah" => ["a","b","c"]}} ...
class Hotel < ApplicationRecord include Rails.application.routes.url_helpers belongs_to :user has_many_attached :photos has_many :favorites, inverse_of: :hotel validates :name, presence: true validates :phone, presence: true validates :price, presence: true validates :address, presence: true validat...
# frozen_string_literal: true def nest(hash) hash.transform_keys(&:to_sym).each_with_object({}) do |(k, v), r| if %i[city zip].include?(k.to_sym) r[:address] ||= {} r[:address][k] = v else r[k] = v end end end hash = { 'name' => 'John', 'city' => 'NY', 'zip' => '1234' } puts nest(ha...
namespace :mamashai do desc "推送送宝宝日历宝典" task :send_bbrl_article => [:environment] do keys = %w(JTN_DI7gR9e45j_JUBCz6A:A2R0Bf_vSLm40wYLYoP4HQ HeMgqDP4SHKrZAn_dS_p1A:GROO_u1AQPi-XLRh9O7ixg 7vYTvD1ISfavgtt-MeQJwg:nWfmYnDhRcKNnNagbMs7tQ JTN_DI7gR9e45j_JUBCz6A:A2R0Bf_vSLm40wYLYoP4HQ HeMgqDP4SHKrZAn_dS_p1A:GROO_u1AQ...
Rails.application.routes.draw do resources :cryptos root 'pages#home' post '/unit', to: 'cryptos#unit' post 'scrap', to: 'cryptos#scrap' post '/refresh', to: 'cryptos#refresh' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
require 'spec_helper' describe VersionChange do context 'relationships' do it { should belong_to(:version) } it { should have_many(:change_notifications) } end context 'i18n methods' do subject do change = VersionChange.new change.version = Version.new change.version.trackable = Wo...
class User < ActiveRecord::Base rolify # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :lockable # ...
module CollectionSpace module Converter module PublicArt class PublicArtOrganization < Organization ::PublicArtOrganization = CollectionSpace::Converter::PublicArt::PublicArtOrganization def convert run(wrapper: "document") do |xml| xml.send( "ns2:organi...
class ProductSerializer < ActiveModel::Serializer attributes :id, :name, :category, :price, :amount, :points, :img has_many :order_items has_many :orders, through: :order_items has_many :users, through: :orders end
module Api::V1 class NotificationsController < ApiController before_action :authenticate before_action :set_raffle def create_notifications_for_raffle if !@raffle.numbers.blank? for number in @raffle.numbers do notification = Notification.new(notification_params) notific...
class JourneyLog attr_reader :history, :current_journey def initialize @history = [] @current_journey = {} end def start(station) @current_journey[:entry] = station @journey = Journey.new(station) end def finish(station) @current_journey[:exit] = station @history << @current_journe...
class TenderBidResultSerializer < ActiveModel::Serializer attribute(:award_criteria_section) do object end attribute(:award_criteries) do object.try(:award_criteries) end attribute(:bid_results) do bid_result = [] object.try(:award_criteries).each do |criteria| bid_result << criteria.try(:m...
#require "rails_admin/application_controller" #module RailsAdmin #class ApplicationController < ::ApplicationController # before_filter :is_admin? # # private # # def is_admin? # if current_user.nil? || current_user.role.name != "Sysadmin" # head(:forbidden) # false # end # end # end #end
# frozen_string_literal: true class ImageSerializer < ActiveModel::Serializer attributes :id, :filename, :url, :darkness, :active?, :created_at, :updated_at end
module Assetable # Interface to find any asset. # # You need extend this in you base class so that you can do the following. # # class Base; extend AssetableFinders' end # # Base.all #=> [BaseObject, BaseObject] # # Base.find(name:'foo') #=> BaseObject(name: 'foo.ext') # # # This assumes you ha...
class ChangeEntryValueToJsonb < ActiveRecord::Migration[5.2] def change add_column :entries, :value, :jsonb, default: {} end end
class AddCustomValuesToNotifications < ActiveRecord::Migration[5.1] def up add_column :notifications, :aggregation_time, :integer, default: 3 add_column :notifications, :interval_to_send, :integer, default: 10 change_column :notifications, :limit_value, :integer, default: 50 end def down remove_c...
class ContractorsController < ApplicationController before_action :set_contractor, only: [:show, :edit, :update, :destroy] def index @contractors = Contractor.order(:name) end def show @proposals = @contractor.proposals.order(:created_at) end def new @contractor = Contractor.new end def ...
require './lib/EntradasTeclado.rb' describe 'EntradasTeclado' do it "cuando el usuario ingrese la tecla 'q' debe decir GoodBye" do #Arrange entradas_teclado=EntradasTeclado.new #Act resultado=entradas_teclado.ingresar_tecla('q') #Assert expect(resultado).to eq "GoodBye" end it "cuando el usuar...
class User < ActiveRecord::Base has_secure_password has_many :characters end
require 'Minitest/autorun' require 'Minitest/rg' require_relative '../room.rb' require_relative '../guest.rb' require_relative '../song.rb' class TestRoom < Minitest::Test def setup() @test_room = Room.new(1, 5, 20) @guest_1 = Guest.new("First_0", "Last_0", 20) @guest_2 = Guest.new("First_1"...