text
stringlengths
10
2.61M
# encoding: UTF-8 module Purgeable version = nil version_file = ::File.expand_path('../../../GEM_VERSION', __FILE__) version = File.read(version_file) if version.nil? && ::File.exists?(version_file) version = $1 if version.nil? && ::File.expand_path('../..', __FILE__) =~ /\/purgeable-(\d+(?:\.\d+)+)/ if versi...
LABELS = INPUT.chars.map(&:to_i).freeze class Cup attr_reader :label attr_accessor :next def initialize(label) @label = label @next = self end def insert!(cup) cup.next = @next @next = cup end end def move!(cups, current) taken = [current.next, current.next.next, current.next.next.next...
# -*- coding: utf-8 -*- module Procedural module Adapters module PostgreSQLAdapter def create_procedure(*args) options = args.extract_options! procedure_name = args.shift language = options.fetch(:language) returns = options.fetch(:returns) sql = options.fetch(:sql) ...
module ListConcern extend ActiveSupport::Concern included do has_many :lists, foreign_key: :superinformation_id, dependent: :destroy has_many :list_items, through: :lists, dependent: :destroy end end
# frozen_string_literal: true RSpec.describe 'Coaches' do resource 'Admin coaches' do let!(:coach1) { create(:coach, :featured) } let!(:coach2) { create(:coach, :featured) } let!(:coach3) { create(:coach) } let!(:coach4) { create(:coach, :deleted) } # NOTE: Deleted records are not returned by default...
require File.dirname(__FILE__) + '/spec_helper' describe Smsinabox::Reply do before(:each) do xml = <<-EOF <api_result> <data> <replyid>3903103</replyid> <eventid>33368123</eventid> <numfrom>27123456789</numfrom> <receiveddata>Bar</receiveddata> <sentid>339548269</sentid> <sentdat...
require 'rails_helper' RSpec.describe UserSearchService do describe '#find' do before :each do create :user, email: 'michael@email.com', full_name: 'Michael Scott', metadata: 'best, boss' create :user, email: 'dwight@email.com', full_name: 'Dwight Shrute', metadata: 'beets, bears' end contex...
#!/usr/bin/env ruby # encoding: utf-8 # from http://rdoc.info/github/ruby-amqp/amqp/master/file/docs/GettingStarted.textile require "bundler" Bundler.setup require "amqp" AMQP.start do |connection| channel = AMQP::Channel.new(connection) exchange = channel.fanout("nba.scores") channel.queue("joe").bind(exch...
module Campfire class Manager attr_reader :connection def initialize(options) @connection = Connection.new(options) end def rooms find_rooms 'rooms' end def presence find_rooms 'presence' end # TODO: validate blank search def search(term) @connection.get...
# nth_prime.rb require 'prime' class Prime @@primes = [2, 3, 5, 7] def self.is_prime(num) return false if num == 1 return false if num.even? && num > 2 return false if (num % 3).zero? return false if (num % 5).zero? [*(7..(Math.sqrt(num).to_i))].each do |factor| return false if (num % ...
FactoryBot.define do factory :tweet do text { Faker::Lorem.word } user_id nil end end
class Dealer attr_accessor :cards, :scores, :bank TOTAL_SCORE = 21 MAX_CARDS = 3 ACE = 1 def initialize @bank = 100 @cards = [] end def minus_cash(sum) @bank -= sum end def sum_cards sum = @cards.sum(&:value) ace_correction(sum) end def ace_correction(sum) @cards.each...
class AddLastLogoutUser < ActiveRecord::Migration def change add_column :users, :last_logout, :datetime end end
class Habit < ApplicationRecord validates :name, presence: true has_many :states belongs_to :user end
class AddFeeToEvents < ActiveRecord::Migration[5.1] def change add_column :tournaments, :fee, :decimal add_column :tournaments, :url, :string end end
class CreateLicences < ActiveRecord::Migration def change create_table :licences do |t| t.string :number, null: false, limit: 16 t.date :reg_date, null: false t.string :type, null: false, limit: 32 t.text :name, null: false t.date :expiration_date t.string :req_number t...
FactoryBot.define do factory :order do customer_id { 1 } postage { 800 } total_price { ((Item.find(1).price * 1.1).floor * CartItem.find(1).quantity) + 800 } delivery_name { Gimei.kanji } delivery_address { Gimei.address.kanji } delivery_postcode { Faker::Address.postcode } end end
class Day03Solver < SolverBase def call color_plane(plane, claims) plane end def claims @claims ||= parse_to_claims @input end def plane @plane ||= make_plane claims end def self.display_plane(plane) plane.each do |row| puts row.join('|') end end def self.overlapping...
# frozen_string_literal: true module Blog module Commands class BecomeAwesomeSubscriber attr_reader :logger, :service def initialize(logger:, service:) @logger = logger @service = service end def call(email) logger.call('starting subscription...') service...
require 'rails_helper' RSpec.describe Services::CreateServiceTransaction do let(:transaction_call) { transaction.call(vin) } let(:transaction) do described_class .new .with_step_args( create_service: [ service: service ] ) end let(:service) { { start_date: Time.c...
class CreateParticularDiscounts < ActiveRecord::Migration def self.up create_table :particular_discounts do |t| t.decimal :discount, :precision =>15, :scale => 2 t.references :particular_payment t.string :name t.timestamps end end def self.down drop_table :particular_discount...
require_relative 'spec_helper' describe "Block class" do before do @block = Hotel::Block.new(id: 1, dates: ["12 May", "13 May", "14 May"], open_rooms: [1, 2, 3], booked_rooms: []) describe "initializer" do it "is an instance of block" do @block.must_be_kind_of Hotel::Block end it ...
class Game < ApplicationRecord belongs_to :user def user_attributes=(user_name) self.user = User.find_or_create_by(name: user_name) end end
class FillInIssueTypes < ActiveRecord::Migration[5.0] def change issue_types = [ {name: "New Feature", icon_path: "new_feature.svg", display_order: 0}, {name: "Bug", icon_path: "bug.svg", display_order: 1}, {name: "Task", icon_path: "task.svg", display_order: 2}, {name: "Improvement", icon...
class Person attr_accessor :name attr_accessor :cash def initialize(person_name, cash_on_hand) @name = person_name @cash = cash_on_hand puts "Hi, #{name}. You have $#{@cash}!" end end class Bank attr_accessor :bank attr_accessor :accounts attr_accessor :amount attr_accessor :withdraw attr_access...
require 'chemistry/element' Chemistry::Element.define "Sulfur" do symbol "S" atomic_number 16 atomic_weight 32.065 melting_point '388.51K' end
# A Robut::Storage implementation is a simple key-value store # accessible to all plugins. Plugins can access the global storage # object with the method +store+. All storage implementations inherit # from Robut::Storage::Base. All implementations must implement the class # methods [] and []=. class Robut::Storage::Bas...
# frozen_string_literal: true FactoryBot.define do factory :mhv_account do user_uuid { SecureRandom.uuid } account_state 'unknown' mhv_correlation_id nil registered_at nil upgraded_at nil end trait :upgraded do account_state :upgraded registered_at Time.current upgraded_at Time.c...
class Building < ActiveRecord::Base has_many :roomies, :class_name => 'Roomie' validates_presence_of :name, :number end
require 'active_model' module LD4L module OreRDF class Aggregation < DoublyLinkedList @@clear_first_callback = lambda { |aggregation| aggregation.first_proxy = nil } @@clear_last_callback = lambda { |aggregation| aggregation.last_proxy = nil } @@update_first_callback = lambda { |aggregation...
FactoryGirl.define do factory :article do title lead { generate :string } body published_at { DateTime.now } author_id { User.last&.id || create(:user).id } photo { generate :file } state { Article.state_machines[:state].states.map(&:name).first.to_s } end end
class Calendar < ActiveRecord::Base acts_as_archive belongs_to :user, :touch => true validates_presence_of :uri, :title, :user validates_format_of :uri, :with => /^https?:\/\/.+\..+/ validates_uniqueness_of :uri, :title, :scope => :user_id after_save { |calendar| calendar.user.touch } after_destroy ...
require 'test_helper' class SongTest < ActiveSupport::TestCase setup do @song = songs(:one) @album = albums(:one) end test 'should not save empty song' do song = Song.new song.save refute song.valid? end test 'should save valid song' do song = Song.new song.song_title = 'Song' ...
# -*- mode: ruby -*- # vi: set ft=ruby : # Specify the version of Sup SUP_VER = ENV['SUP_VER'] || "v0.5" $script = <<SCRIPT sudo apt-get install -y curl echo Fetching Sup $1 ... cd /tmp/ curl -sSL https://github.com/pressly/sup/releases/download/$1/sup-linux64 -o sup echo Installing Sup $1 ... sudo chmod +x sup su...
class Beer < ActiveRecord::Base validates :name, presence: true, length: { minimum: 2, maximum: 50 }, uniqueness: { case_sensitive: false } validates :alcohol, numericality: true, length: { maximum: 6 }, allow_blank: true validates :brewery, :brewery_url, :style, length: { minimum: 2, maximum: 200 }, allow_blank: tr...
class MoviesController < ApplicationController def movie_params params.require(:movie).permit(:title, :rating, :description, :release_date) end def show id = params[:id] # retrieve movie ID from URI route @movie = Movie.find(id) # look up movie by unique ID # will render app/views/movies/show.<e...
class GaugesController < ApplicationController unloadable helper :sort include SortHelper helper :queries include QueriesHelper helper :issues include IssuesHelper before_filter :find_project, :authorize, :only => :index def index @base_date = params.include?(:base_date) ? Date.strptime(params[...
module Roglew class RenderbufferEXT include Roglew::Contextual(RenderbufferContextEXT) attr_reader :handle, :id def initialize(handle) @handle = handle @id = handle.bind { |context| context.gen_renderbuffersEXT } ObjectSpace.define_finalizer(self, self.class.finalize(@handle, ...
class Character class Dead < RuntimeError; end attr_accessor :attack, :armor, :mp, :mana_used attr_reader :hp def initialize(hp, attack, mp = 0) @hp = hp @mp = mp @attack = attack @armor = 0 @mana_used = 0 end def hp=(value) @hp = value raise Dead if value < 0 end def hit...
class ReserveMailer < ApplicationMailer def submit_request(reserve, address, current_user) @reserve = reserve @current_user = current_user mail(to: address, subject: "#{reserve.has_been_sent ? 'Updated' : 'New'} Reserve Form: #{reserve.cid}-#{reserve.sid} - #{reserve.term}") end end
# # create the method. print out that we're adding 2 numbers together and then return the sum. # def add(a, b) # puts "adding #{a} and #{b}: " # return a + b # end # #call the method # puts add(2, 3) # puts add(10, 50) # puts add(3,8) # ##########SIMPLE METHODS############ # #saying hello # def hello(name1, name...
class CommentsController < ApplicationController layout 'unpublic' before_action :confirm_logged_in before_action :privilege, :only => [:all] before_action :check, :only => [:edit, :update, :delete, :destroy] before_action :update_average_rating, :only => [:index] def index @shop = Shop.find(params[:sh...
class AddCalToUltrasonics < ActiveRecord::Migration def change add_column :ultrasonics, :cal_block, :string end end
class User < ApplicationRecord has_many :cuisine_preferences has_many :matches has_many :cuisines, through: :cuisine_preferences has_secure_password validates :email, presence: true validates :email, uniqueness: true end
# coding: utf-8 require 'rbconfig' class TestMeCabNode < Minitest::Test def setup @host_os = RbConfig::CONFIG['host_os'] @arch = RbConfig::CONFIG['arch'] if @host_os =~ /mswin|mingw/i @test_cmd = 'type "test\\natto\\test_sjis"' else @test_cmd = 'cat "test/natto/test_utf8"' end ...
require 'spec_helper' describe Pusher do describe ".push_message" do let(:recipient1) { double('recipient1', user: double('user', id: 1, user_name: 'bob')) } let(:recipient2) { double('recipient2', user: double('user', id: 2, user_name: 'jeff')) } let(:recipients) { [recipient1, recipient2] } let(:...
#encoding: utf-8 module Concerns::Admins::ImageUpload def upload_cover_img file,path if file.present? && file.original_filename.present? && file.size < 5 * 1024 * 1024 && file.size > 0 filename=get_file_name(file.original_filename) url = "#{path}#{filename}" File.open(url, "wb"){|f| f.write(file....
# Source: https://launchschool.com/exercises/675bc8c9 def multisum(max_val) valid_factor = [] (1..max_val).each do |x| valid_factor << x if (x % 3).zero? || (x % 5).zero? end valid_factor.sum end # P: # Question: # Write a method that searches for all multiples of 3 or 5 that lie between # 1 a...
require "spec_helper" RSpec.describe "Day 12: JSAbacusFramework.io" do let(:runner) { Runner.new("2015/12") } describe "Part One" do it "sums all numbers in the document" do expect(runner.execute!("[1,2,3]", part: 1)).to eq(6) expect(runner.execute!('{"a":2,"b":4}', part: 1)).to eq(6) expect...
class MenuPagesController < ApplicationController # GET /menu_pages # GET /menu_pages.xml def index @menu_pages = MenuPage.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @menu_pages } end end # GET /menu_pages/1 # GET /menu_pages/1.xml def sh...
# Practice Problem 5 # Given this nested Hash: munsters = { "Herman" => { "age" => 32, "gender" => "male" }, "Lily" => { "age" => 30, "gender" => "female" }, "Grandpa" => { "age" => 402, "gender" => "male" }, "Eddie" => { "age" => 10, "gender" => "male" }, "Marilyn" => { "age" => 23, "gender" => "female"} } ...
class Project < ActiveRecord::Base include Concerns::Removable, Concerns::Tokenable has_many :project_user_relations, dependent: :destroy has_many :users, through: :project_user_relations has_many :invites has_many :tasks, dependent: :destroy has_many :milestones, dependent: :destroy has_o...
module WordLadder class Word attr_reader :key, :dictionary def initialize(word, dictionary) @key = word.downcase @dictionary = dictionary dictionary.validate_word(word) end def next_words @next_words ||= gen_next_words.sort { |a, b| a.key <=> b.key } end private ...
require "ensembl/version" require 'active_record' require 'yaml' require 'active_support/core_ext' module Ensembl # Load configuration from database.yml ActiveRecord::Base.configurations = YAML::load(IO.read('config/database.yml')) module TableNameOverrides def table_name self.name.split('::').last.un...
module XPash class Base def grep(*args) # parse args opts = optparse_grep!(args) keyword = args[0] if opts[:all] query = ROOT_PATH node_ary = [@doc] elsif args[1] query = getPath(@query, args[1]) node_ary = @doc.xpath(query, $xmlns) return nod...
class Tfl < ActiveRecord::Base belongs_to :company has_many :employees validates_presence_of :name end
# :nodoc: class SettingsHandlerBase < YARD::Handlers::Ruby::Base handles method_call :string_setting handles method_call :number_setting handles method_call :boolean_setting namespace_only def process name = statement.parameters.first.jump(:tstring_content, :ident).source object = YARD::CodeObjects:...
Rails.application.routes.draw do resources :tasks root "tasks/#index" end
# frozen_string_literal: true module Vedeu module Colours # The class represents one half (the other, can be found at # {Vedeu::Colours::Foreground}) of a terminal colour escape # sequence. # # @api private # class Background < Vedeu::Colours::Translator # @return [Boolean] ...
class Tag < ActiveRecord::Base has_many :dream_tags has_many :dreams, through: :dream_tags end
class TestExecutionsController < ApplicationController before_filter :authorize_global before_filter :find_execution, :only => [:show] helper :tests def show end private def find_execution @execution = TestExecution.find(params[:id], :include => {:logs => :case}) rescue ActiveRecord::RecordNotFo...
module RougeHighlighter class ViewHooks < Redmine::Hook::ViewListener def view_layouts_base_html_head(context={}) val = %{ /************* Rouge styles *************/ /* generated by: pygmentize -f html -a .syntaxhl -S colorful */ .syntaxhl .hll { background-color: #ffffcc } .syntaxhl { background: #fafafa;...
module Bitfinex module WalletClient # See your balances. # # @param params :type [string] “trading”, “deposit” or “exchange”. # @param params :currency [string] currency # @param params :amount [decimal] How much balance of this currency in this wallet # @param params :available [decimal] How...
class ChangeColumnInUsers2 < ActiveRecord::Migration[5.1] def change change_column :users, :income, :integer end end
require './spec_helper' describe Robot do before :each do @robot = Robot.new end describe "#shield" do it "should be 50" do expect(@robot.shield_points).to eq(50) end end describe "#charge" do it "should charge battery if below 50" do enemy = Robot.new enemy.attack(@ro...
FactoryBot.define do factory :book do title { Faker::Book.title } author { Faker::Book.author } image { Faker::Avatar.image } end end
# frozen_string_literal: true class CreateIncidents < ActiveRecord::Migration[5.2] def change create_table :incidents do |t| t.string :number t.string :slug t.string :title t.text :description t.references :user, foreign_key: true t.integer :status t.datetime :pending ...
class CalculationSerializer < BaseSerializer attributes :id, :result, :virtual def id object.id.to_s end def result object.result * object.result end def virtual 'virtual' end end
class Product < ActiveRecord::Base has_and_belongs_to_many :troves def update_from_shopsense attributes = Shopsense.find_by_shopsense_id(self.shopsense_id) self.update(attributes) end end
Rails.application.routes.draw do devise_for :users, controllers: { sessions: "users/sessions" } get 'static_pages/home' get '/profile', to: 'static_pages#profile' # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root 'static_pages#home' end
class Part < ActiveRecord::Base belongs_to :project belongs_to :user has_many :comments, -> { where(:archived => false) }, :as => :commentable, :dependent => :destroy has_many :all_comments, :as => :commentable, :dependent => :destroy, :class_name => "Comment" has_many :suggestions, :dependent => :destroy ...
module HttpAuthConcern extend ActiveSupport::Concern included do before_action :http_authenticate end def http_authenticate return true unless Rails.env == 'production' authenticate_or_request_with_http_basic do |username, password| username == 'username' && password == 'password' end end end
require './app/aircraft.rb' describe Aircraft do let(:aircraft){Aircraft.new(:name=>'Boeing737', :number_of_seats=>787)} let(:tiny_aircraft){Aircraft.new(:name=>'Tiny1', :number_of_seats=>1)} it 'should be able to initialize the aircraft' do ex...
require 'spec_helper' require 'belafonte/argument' module Belafonte describe Argument do describe '.new' do it 'requires a name' do expect {described_class.new}. to raise_error(Belafonte::Errors::NoName, "Arguments must be named") expect {described_class.new(name: :jump)}. ...
# Research Methods # I spent [] hours on this challenge. i_want_pets = ["I", "want", 3, "pets", "but", "only", "have", 2] my_family_pets_ages = {"Evi" => 6, "Ditto" => 3, "Hoobie" => 3, "George" => 12, "Bogart" => 4, "Poly" => 4, "Annabelle" => 0} # Person 1 def my_array_finding_method(source, thing_to_find) arra...
class CuratorialsController < ApplicationController before_action :logged_in_user, except: [:show, :index] before_action :set_curatorial, only: [:show, :edit, :update, :destroy] before_action :get_curatorial_years before_action :get_writing_years def new @user = current_user @curatorial = @user.cura...
class ChangeSaleAdjustedPagesToInteger < ActiveRecord::Migration def change change_column :sales, :adjusted_page_count, :integer end end
module Twine module Formatters class JQuery < Abstract def format_name 'jquery' end def extension '.json' end def default_file_name 'localize.json' end def determine_language_given_path(path) match = /^.+-([^-]{2})\.json$/.match File.bas...
require 'rails_helper' RSpec.describe 'Weapons', type: :request do describe 'GET /show' do it 'show attributes' do attributes = FactoryBot.attributes_for(:weapon, name: 'textweapon', description: 'descweapon') post(weapons_path, params: { weapon: attributes }) get weapon_path(Weapon.last) ...
class UsersController < ApplicationController before_action :confirm_logged_in, only: [:edit, :update, :show] before_action :find_user_from_session, only: [:edit, :update, :show] layout 'dashboard', only: [:show] def new @user = User.new end def create @user = User.new(user_params) if @user.sa...
module Yito module Model module Booking module ActivityQueries def self.extended(model) model.extend ClassMethods end module ClassMethods # # Search booking by text (customer surname, phone, email) # def text_se...
require 'capybara/cucumber' require 'capybara-screenshot/cucumber' require 'base64' Before do |scenario| Capybara::Screenshot.final_session_name = nil end After do |scenario| if Capybara::Screenshot.autosave_on_failure && scenario.failed? Capybara.using_session(Capybara::Screenshot.final_session_name) do ...
require File.join(File.dirname(__FILE__), 'BaiduPage') module SearchBehavior def visit_Baidu @page = BaiduPage.new(@browser) end def user_text user_str @page.send_key user_str end def user_click @page.click_search end def assert_text_exist title_text @page.has_text title_text end end
class ProductAsset < ActiveRecord::Base belongs_to :product validates :photo, attachment_content_type: { content_type: /\Aimage\/.*\Z/ }, attachment_size: { less_than: 5.megabytes } has_attached_file :photo, styles: { thumb: '100x100>', square: '200x200#', medium: '300x300>' } end
module JobsCrawler::Robots class Base attr_reader :url def initialize(url) @url = url @engine = Mechanize.new end def crawl set_html to_json end def extract_content(css_selector) @html.css(css_selector).text end def to_json raise NotImplemetedErr...
class TrustUpdateService def update_trusts(last_update: nil) # look at the trusts that have changed since the last update last_update ||= DataStage::DataUpdateRecord.last_update_for(:trusts) # create new trusts create_trusts # simple updates for trusts that are open update_open_trusts(last_u...
# frozen_string_literal: true module EMIS module Models class GuardReserveServicePeriod include Virtus.model attribute :segment_identifier, String attribute :begin_date, Date attribute :end_date, Date attribute :termination_reason, String attribute :character_of_service_code,...
require 'anniversary_checker' require 'git_interface' class App DEFAULT_COMMITS_BETWEEN_ADIVS = 1000 def self.run(config) Dir.chdir config[:git_path] git_interface = config[:git_interface] || default_git_interface persistence = config[:persistence] || default_persistence notifier = config[:no...
require_relative 'piece.rb' class Queen < Piece def initialize(color) @color = color end public def possible_moves moves = [] column = self.get_column row = self.get_row moves << get_right_diags(column, row) moves << get_left_diags(column, row) moves << get_verticals(column...
class Message < ActiveRecord::Base has_many :notifications belongs_to :messageable, polymorphic: true, counter_cache: true belongs_to :user after_create :track_notification before_create :convert_content validates :content, presence: true, length: { maximum: 400 } validates :messageable_type, inclusion:...
class ApplicationController < ActionController::Base before_action :authenticate_user!, unless: :devise_controller? rescue_from ActionController::InvalidAuthenticityToken, with: :redirect_and_prompt_for_sign_in protected def redirect_and_prompt_for_sign_in redirect_to(new_user_session_path, alert: 'P...
class Dog attr_reader :name ,:raza ,:color def initialize args @nombre = args[:nombre] @raza = args[:raza] @color = args[:color] end def ladrar puts "#{@nombre} esta ladrando" end end propiedades= {nombre:'Beethoven', raza:'San Bernardo', color:'Café'} dog = Dog.new(propiedades) dog.ladrar
# Copyright 2007-2014 Greg Hurrell. All rights reserved. # Licensed under the terms of the BSD 2-clause license. require 'walrat' module Walrat class ProcParslet < Parslet attr_reader :hash def initialize proc raise ArgumentError, 'nil proc' if proc.nil? self.expected_proc = proc end d...
if @book json.id @book['_id'].to_s json.image request.protocol + request.host_with_port + @book.image.url json.author @book.author json.title @book.title json.description @book.description json.status @book.status json.rating @book.rating json.vote_count @boo...
# == Schema Information # # Table name: pictures # # id :integer not null, primary key # name :string # imageable_id :integer # imageable_type :string # created_at :datetime not null # updated_at :datetime not null # description :string # class Picture...
class SubcollectionJoin < ApplicationRecord belongs_to :parent_collection, class_name: 'Collection' belongs_to :child_collection, class_name: 'Collection' validates_presence_of :parent_collection_id validates_presence_of :child_collection_id validates_uniqueness_of :child_collection_id, scope: :parent_colle...
class Book < ActiveRecord::Base belongs_to :person has_many :insurances, :dependent => :destroy has_many :riders, :dependent => :destroy has_many :pas, :dependent => :destroy belongs_to :assured_person, class_name: "Person", foreign_key: "assured_person_id" belongs_to :payer_person, class_name: "Person", foreign...
Rails.application.routes.draw do devise_for :users # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html root to: 'page#home' get 'location', to: 'restaurant#info' resources :post resources :restaurant end
require 'rails_helper' describe Access do before(:each) do team = Team.create(name: "test_team") @user = User.create(name: "test_user", team_id:team.id) @project = Project.create(name: "test_project", team_id:team.id) end it "is valid with both user and project" do expect(Access.new(user_id: @use...
require_relative 'robot_command' # Represents the Robot Command for Place Instruction class PlaceCommand < RobotCommand attr_accessor :x, :y, :face_name def initialize(robot = nil) @robot = robot end def robot=(robot) @robot=robot end def execute @robot.place(self.x, self.y, self.face_name...