text
stringlengths
10
2.61M
# == Schema Information # # Table name: contexts # # id :bigint not null, primary key # approx_end_time :integer # approx_start_time :integer # name :string # superseded_by :integer # created_at :datetime not null # updated_at :datetime no...
# frozen_string_literal: true class AddReferencesToPurchases < ActiveRecord::Migration[6.1] def change add_reference :purchases, :user, null: false, foreign_key: true add_reference :purchases, :product, null: false, foreign_key: true end end
class VotesController < ApplicationController before_filter :authenticate_user!, only: [:create] def create @photo = Photo.find(params[:vote][:photo_id]) @vote = @photo.votes.new(photo_params) @vote.user = current_user @voted = Vote.where(:user_id=>@vote.user.id).where(:photo_id=>params[:vote][:pho...
RLS.policies_for :users do using_tenant check_tenant end
require 'rubygems' require 'define_exception' require 'validators' include DefineException class Sorter attr_accessor :data_table define_exception :undefined_sort_order, 'sort order must be :asc or :desc' include Validators def initialize( data_table ) validate_data_table( data_table ) @data_tabl...
class Converter def initialize @last_node_id = 0 @from_node_id = nil @node_names = {} @tree = [] end def branch(node_from,node_to,edge) %Q| #{node_from} -> #{node_to} [label="#{edge}"]| end def new_node_id @last_node_id += 1 @last_node_id end def assign_name_to_node(name,no...
class CoordinatorDatatable < AjaxDatatablesRails::Base def_delegators :@view, :link_to, :h, :mailto, :edit_resource_path def sortable_columns # Declare strings in this format: ModelName.column_name @sortable_columns ||= %w(User.id User.active User.name User.lastname User.usertype User.gender User.email User...
class Ship < ActiveRecord::Base belongs_to :game_player has_many :ship_cell end
require 'baby_squeel/nodes/node' require 'baby_squeel/nodes/attribute' require 'baby_squeel/nodes/function' require 'baby_squeel/nodes/grouping' require 'baby_squeel/nodes/binary' module BabySqueel module Nodes class << self # Wraps an Arel node in a Proxy so that it can # be extended. def wrap...
# frozen_string_literal: true require 'traject/macros/marc21' TOPIC_TAGS = %w[ 630 650 654 ].freeze UNHELPFUL_SUBJECTS = [ 'Electronic book', 'Electronic books', 'History', 'Internet videos', 'Streaming video' ].freeze OFFENSIVE_VALUE_REPLACEMENTS = { 'Aliens' => 'Noncitizens', 'Illegal aliens' ...
class PictureUploader < CarrierWave::Uploader::Base attr_accessor :picture, :remove_picture # include RMagick or MiniMagick support: # include CarrierWave::RMagick include CarrierWave::MiniMagick # Image storage # Storage of uploaded images - production or development if Rails.env.production? storag...
=begin input: string output: hash ALGORITHM - Split input string into individual words - Iterate through collection, and transform each element into a nested array that contains current word and how many times in appears in collection - Remove duplicates - Turn nested arrays into a hash =end class Phrase def init...
# Create a Ruby class called Article inside a module called Blog that has two attributes: title and body. Write another class called Snippet that inherits from the Article class. The Snippet method should return the same `title` but if you call `body` on a snippet object it should return the body truncated to a 100 cha...
class Course < ApplicationRecord CURRENCIES = Rails.application.config_for(:settings)['support_currencies'] belongs_to :category has_many :orders has_many :purchased_records, -> { purchased }, class_name: :Order scope :filter_by_category , lambda { |category| includes(:category).where( categories: { nam...
class CreateExcavators < ActiveRecord::Migration[6.0] def up create_table :excavators do |t| t.string :company_name t.string :address t.string :city t.string :state t.string :zip t.boolean :crew_on_site t.references :ticket t.timestamps end end def down ...
module Interpreter class Processor module TokenProcessors def process_try(_token) body_tokens = next_tokens_from_scope_body error = nil result = nil with_scope Scope.new(@current_scope, Scope::TYPE_TRY, body_tokens) do begin result = process ...
# Define a method five_times # which takes a number as an argument and # returns the value that results when the argument is multiplied by 5. # Define a method hund_times, # which takes and argument and returns the result of that argument being multiplied by 100. # Define a method div_seven which takes an argume...
class AddCoverImageToRides < ActiveRecord::Migration[6.0] def change add_column :rides, :cover_image_url, :string rename_column :motorcycles, :image_path, :image_url rename_column :photos, :image_path, :image_url rename_column :routes, :map_path, :map_url end end
require 'spec_helper' module BrowserMob module Proxy DOMAIN = 'example.com' describe Client do let(:resource) { double(RestClient::Resource) } let(:client) { Client.new(resource, "localhost", 9091) } before do { "har" => double("resource[har...
require File.dirname(__FILE__) + '/../spec_helper' require File.dirname(__FILE__) + '/../models/et_spec_helper' # AJA TODO: static methods module ETSubscriberEditSpecHelper LIST_ID = ET_ACCOUNTS[:automatic][:all_subscribers_list_id] OLD_EMAIL_ADDRESS = 'old@address.com' end describe ETSubscriberEdit do...
class GG0170p2 attr_reader :options, :name, :field_type, :node def initialize @name = "Mobility - Picking up object (Discharge Goal) - The ability to bend/stoop from a standing position to pick up a small object, such as a spoon, from the floor. (GG0170p2)" @field_type = DROPDOWN @node = "GG0170P2" ...
class Contact < ActiveRecord::Base belongs_to :user has_many :plans, :dependent => :delete_all has_one :test_score STATUSES = [ ['to_invite', 'por invitar'], ['contacted', 'contactado'], ['to_close', 'por cerrar'], ['registered', 'inscrito'], ['to_register', 'por inscribir'], ['ruled_o...
class AddColumnsToMovies < ActiveRecord::Migration[5.1] def change add_column :movies, :title, :string add_column :movies, :genre , :string add_column :movies, :year, :integer add_column :movies, :synopsis, :string add_column :movies, :favorite_movies :string end end
class AddReferenceToSubscriptionHistory < ActiveRecord::Migration[5.1] def change add_reference :subscription_histories, :member, index: true end end
require 'test_helper' describe GP do let(:bd) { '.depot.txt' } describe "retirer" do context "base de donnees avec plusieurs pieces" do let(:lignes) { IO.readlines("#{REPERTOIRE_TESTS}/piece.txt.2") } let(:attendu) { ['A00001 Info: "INTEL I7" Type : CPU', 'A00002 In...
# frozen_string_literal: true require_relative "tidied/version" require_relative "tidied/sorting" require_relative "tidied/filtering" class Tidied class Error < StandardError; end def initialize(collection) @collection = collection end def sort(*instructions) Sorting.new(*instructions).execute(@view...
require File.dirname(__FILE__) + '/../spec_helper' require 'hpricot' describe LogEntryRetriever do before(:each) do @log_entry_elements = Hpricot(mock_svn_log_xml).search("log/logentry") @log_entries = LogEntryRetriever.new(mock_svn_sheller).retrieve end it "should return an entry for each logentry elem...
FactoryBot.define do factory :team_transfer, class: Team::Transfer do user team is_joining { true } end end
require 'spec_helper' describe Turnt::User do describe '#email' do it 'should return `git config --global --get user.email`' do allow(Turnt::GitUtils).to receive(:global_config) .with('user.email') .and_return('macklin@user.com') expect(Turnt::User.ema...
class RatesController < ApplicationController before_action :load_rate_by_id, only: :update before_action :find_room, only: %i(create update) load_and_authorize_resource def create @rate = current_user.rates.build rate_params if @rate.save respond_to :js else redirect_to root_path ...
# # Repetition, `a+`, `a*`, `a?`, `a{1,3}`, `a{,3}`, `a{1,}`, `a{3}` # Sreg project # # Shou, 2 August 2012 # module Sreg module Builder module AbstractSyntaxTree class AbsRepetition < Node Inf = -1 attr_reader :min, :max attr_reader :member def initialize(member, mi...
# frozen_string_literal: true require 'your_ruby' require 'time' RSpec.describe 'YourRuby' do describe '.fizzbuzz' do it 'returns fizzbuzz to 3, returning the number or "fizz" if the number is a multiple of 3' do expect(YourRuby.fizzbuzz(3)).to eq([1, 2, 'fizz']) end it 'returns fizzbuzz to 5, wi...
require 'kintone/command' require 'kintone/api' class Kintone::Command::Records PATH = "records" def initialize(api) @api = api @url = @api.get_url(PATH) end def get(app, query, fields) params = {:app => app, :query => query} fields.each_with_index {|v, i| params["fields[#{i}]"] = v} retu...
class UserFct < ActiveRecord::Base belongs_to :user belongs_to :factory end # == Schema Information # # Table name: user_fcts # # id :integer not null, primary key # user_id :integer # factory_id :integer # created_at :datetime not null # updated_at :datetime not null #
class TestPassagesController < ApplicationController before_action :set_test_passage, only: %i[show result update gist] def show; end def result; end def update @test_passage.accept!(params[:answer_ids]) if @test_passage.completed? redirect_to result_test_passage_path(@test_passage) else ...
# frozen_string_literal: true RSpec.describe SC::Billing::Transform do describe '.attrs_to_hash' do subject(:transform) do described_class[:attrs_to_hash, %i[a b c]] end let(:struct) { Struct.new(:a, :b, :c, :d, :e, keyword_init: true) } it :aggregate_failures do input = struct.new(a: 1...
class AddMoreFieldsToFlats < ActiveRecord::Migration[5.0] def change change_column :flats, :flat_nr, :string add_column :flats, :phone, :integer add_column :flats, :relatives, :string add_column :flats, :rooms, :integer add_column :flats, :morepersons, :string add_column :flats, :email, :strin...
require 'rails_helper' RSpec.describe UsdExchangeRate, type: :model do it "is valid" do expect(UsdExchangeRate.new({ rate: 1, is_forced: false, expiration_date: nil, })).to be_valid expect(UsdExchangeRate.new({ rate: 1, is_forced: true, expiration_date: '3rd Feb 20...
class <%=child_class_name%> < ActiveRecord::Base acts_as_nested_set belongs_to :<%=parent_singular_name%> has_attached_file :file, :styles => {:large => '800>', :medium => "300x300>", :thumb => "100x100#" } validates_presence_of :<%=parent_singular_name%> def self.page(search, page) with_permissions_to...
# frozen_string_literal: true FactoryGirl.define do factory :profile do first_name { Faker::Name.first_name } last_name { Faker::Name.last_name } phone { Faker::PhoneNumber.cell_phone } end end
class Api::UsersController < ApplicationController def show client = conditionally_create_client logged_in = user_signed_in? @user = Fitbit::User.new logged_in unless client.nil? info = client.user_info['user'] @user.load info end end end
module ImgCloudHelper # displays a transformed image, accepts a relative image path and height width parameters. Additional parameters if any are ignored, # and the original image is displayed if no or invalid height width parameters are provided. # Example # # img_cloud_tag "/ic_4e1756/1440667545769_14365...
module Pod class Podfile xold_podfile_init_method = instance_method(:initialize) define_method(:initialize) do |defined_in_file = nil, internal_hash = {}, &block| installer = Pod::X::Installer::installer installer.init_self = self installer.init_method = xold_pod...
# VIEW HELPER FUNCTIONS - AVAILABLE IN ALL VIEWS module ApplicationHelper include DeploymentInfoHelper def site_name 'MSI Directory' end def site_version tag = deployed_tag tag.success ? " (#{tag.version})" : "" end def site_url if Rails.env.production? # Place your production URL i...
require 'jeweler' Jeweler::Tasks.new do |gem| gem.name = 'seed_migrator' gem.summary = 'Handle post-release data updates through migrations' gem.description = "Provides a clean way to handle updates to seed data post-launch." gem.email = ['arthur.shagall@gmail.com', 'zbelzer@gmail.com'] gem.h...
require 'require_all' require_rel 'test_classes' require_relative './spec_helpers/violation_checker' describe 'Invariant' do include ViolationChecker it 'should not throw an exception if a class has no invariants' do expect_fulfillment {ClassWithoutInvariants.new.some_method} end it 'should throw invari...
module Dotabuff class Client PARSERS = { HEROES_URL => Dotabuff::Parsers::Heroes, PICK_URL => Dotabuff::Parsers::Pick }.freeze def initialize @mechanize = Mechanize.new { |agent| agent.follow_meta_refresh = true } end def fetch_heroes data = nil @mechanize.get(HEROE...
require 'test_helper' class VisitorCanViewIndexOfVendorsTest < ActionDispatch::IntegrationTest test 'root has link to view vendor index' do visit root_path click_link 'Vendors' assert_equal vendors_path, current_path assert page.has_content?("Jhun's Swag") assert page.has_content?("active") ...
# Generate a gallery for a colorlovers palette. # Json spec: http://www.colourlovers.com/api/ require 'open-uri' require 'json' require 'uri' # For the vector class # (note: install gmath3D gem if not already installed) require 'gmath3D' SITE = "color".downcase DOWNLOAD = true puts "Fetching json..." json = JSON.p...
Rails.application.routes.draw do devise_for :users root 'pages#home' namespace :api, defaults: { format: :json } do namespace :v1 do resources :bartenders, only: [:index, :show, :update, :create, :destroy] end end resources :bartenders do resources :cocktails, only: [:create] resources...
class TranslateHintInDeliveryType < ActiveRecord::Migration def change add_column :delivery_type_translations, :hint, :text remove_column :delivery_types, :hint end end
# Schema # t.string "name", :null => false # t.text "content", :null => false # t.integer "admin_id" # t.datetime "created_at" # t.datetime "updated_at" class StaticPage < ActiveRecord::Base # Associated models belongs_to :admin # Accessible attributes attr_accessible :name, :content, :admin_id...
require_relative '../../../../spec_helper' describe 'govuk::deploy::setup', :type => :class do let(:authorized_keys_path) { '/home/deploy/.ssh/authorized_keys' } let(:actionmailer_config_path) { '/etc/govuk/actionmailer_ses_smtp_config.rb' } context 'keys provided' do let(:params) {{ 'actionmailer_ena...
require 'test_helper' class TeammembersControllerTest < ActionController::TestCase def test_should_get_index get :index, {}, { :user_id => users(:fred).id } assert_response :success assert_not_nil assigns(:teammembers) end def test_should_get_new get :new, {}, { :user_id => users(:fred).id } ...
# encoding: utf-8 module ChinaRegions class RegionsGenerator < Rails::Generators::NamedBase source_root File.expand_path('../../../../app', __FILE__) def copy_models_file copy_file "models/province.rb", "app/models/province.rb" copy_file "models/city.rb", "app/models/city.rb" copy_file...
class SessionsController < ApplicationController def new #defined here only to render the login page. end def create # the session params sent to the browser are 'params[:session] == {email: "xxx@xxx.xxx", password: "<bla bla bla>"}', meaning that the value for :session key is another hash. user = User....
class StringToInteger attr_reader :string def initialize(string) @string = string end def integer result = 0 i = 0 while i < string.length do result *= 10 result += string[i].ord - "0".ord i += 1 end return result ...
module PeopleHelper def member_role(faction, okrug) first ='Член фракції політичної партії "' + faction +'"' unless okrug.nil? first + " обрано по округу номер #{okrug}" else first end end def sort_text if params[:sort] == "faction" "Фракцією" elsif params[:sort] == ...
# changes here require restart of guard include ApplicationHelper # seems not to be used, keep it until finished tutorial #def valid_signin(user) # fill_in "Email", with: user.email # fill_in "Password", with: user.password # click_button "Sign in" #end def sign_in(user) visit signin_path fill_in "Email", ...
# frozen_string_literal: true require 'rails_helper' RSpec.describe 'properties/advertised_monthly_rent', type: :view do let(:landlord) { create(:landlord) } it 'displays all available Properties for rent' do properties = create_list(:property, 2, landlord_email: landlord.email, rented: false, tenants_emails...
# Контроллер постов блога class Content::PostsController < Content::BaseController before_action :get_locale def get_item @post end def item @post = Post.find_by_slug params[:slug] @comments = @post.comments.where( locale: I18n.locale ) raise PageNotFound unless @post.present? end end
require 'test_helper' describe "References controller integration" do it 'lists references' do r1 = create(:reference) r2 = create(:reference) visit references_path attrs = [:title, :authors] must_include_resource(r1, only: attrs) must_include_resource(r2, only: attrs) end it 'show refer...
class DivingsitesController < ApplicationController def show @divingsite = Divingsite.find(params[:id]) @reviews = @divingsite.reviews end def index if params[:search] @divingsites = Divingsite.search(params[:search]).order("created_at DESC") elsif params[:order] == 'alphabetically' @...
require 'rails_helper' class Authentication include ActionController::HttpAuthentication::Token::ControllerMethods include Authenticable end RSpec.describe Authenticable do let(:authentication) { Authentication.new } subject { authentication } describe "#current_user" do before do @user = Factory...
class Notifier < ActionMailer::Base default from: APP_CONFIG[:admin_email] def admin_user_reset_password(admin_user) @reset_password_link = admin_reset_password_url(admin_user.perishable_token, host: APP_CONFIG[:host]) mail( to: admin_user.email, subject: "[MyPerfectWeekend] Password reset" ...
Dado('Acesso a página home') do @home = Home.new() @home.open_home_page end Dado('que clico na lista de funcionalidades chamada {string}') do |btnClick| @home.click_funcionalidade(btnClick) end Dado('clico no link para criar usuários') do @home.click_link_criar_usuarios end Quando('submeto o meu cada...
class TasksController < ApplicationController before_action :set_task, only: [:show, :edit, :update, :destroy] def index @tasks = current_user.tasks.includes(:task_labels) @tasks = @tasks.sort_tasks(params[:sort_column], params[:sort_direction]) search_tasks @tasks = @tasks.page params[:page] end...
module WsdlMapper module Dom # The Namespaces class stores XML namespaces (URLs) along with the prefix/abbreviation used. # e.g. :ns1 => 'http://example.org/mynamespace' # # In addition to that, it allows generation of unique prefixes for URLs not present in this collection. # See {#prefix_for} ...
require 'test_helper' class StockOptionsControllerTest < ActionDispatch::IntegrationTest setup do @stock_option = stock_options(:one) end test "should get index" do get stock_options_url assert_response :success end test "should get new" do get new_stock_option_url assert_response :succ...
require "ssh/copy-process" # # Copy a file via SSH. The following options are available: # # <tt>:logger</tt>:: Save logs with the specified logger [nil] # <tt>:verbose</tt>:: Be verbose [nil] # <tt>:dry_run</tt>:: Print the commands that would be executed, but do not execute them. [nil] # # Usage: # # # Copy /tmp/...
require 'yaml' require 'aws/s3' require "active_support" task :default => ['components/oyITaboo.xpt', :xpi] file 'components/oyITaboo.xpt' => 'components/oyITaboo.idl' do puts "Generating oyITaboo.xpt. (requires flock dev environment)" `xpidl -m typelib -w -v -I $o/dist/idl -o components/oyITaboo components/oyITa...
module QuickShort # When there is no such prefix class NoSuchPrefix < StandardError def initialize(prefix) super "No such prefix registered: #{prefix}" end end end
class Actor < ApplicationRecord belongs_to :production, polymorphic: true end
class Provider::Admin::Messages::OutboxController < FrontendController before_action :build_message, :only => [:new, :create] activate_menu :buyers, :messages, :sent_messages def new activate_menu :buyers, :messages, :inbox @message.to recipients end def destroy @message = current_account.messag...
module CampfireBot class Message < ActiveSupport::HashWithIndifferentAccess def initialize(attributes) self.merge!(attributes) self[:message] = self['body'] if !!self['body'] self[:person] = self['user']['name'] if !!self['user'] self[:room] = attributes[:room] end def reply(s...
class AddAuthorSubscriptionToTopics < ActiveRecord::Migration def self.up add_column :topics, :author_subscription, :string add_index :topics, :author_subscription Topic.all.each do |topic| topic.generate_author_notification topic.save end end def self.down remove_index :topics, ...
require 'spec_helper' describe MoneyService do describe '#format' do let(:currency) { 'usd' } subject { described_class.format(10,currency) } context 'usd' do it 'should format the money' do expect(subject).to eq "$10.00" end end context 'gbp' do let(:currency) { 'gbp...
# frozen_string_literal: true FactoryBot.define do factory :user do email { 'user@example.com' } admin { false } factory :admin_user do admin { true } end end end
class UserRoleProvider def initialize(module_provider) @module_provider = module_provider end def has_role(user, role) users = @module_provider.get_users_by_role(role) users.include?(user.email) end def get_role(user) role_data = @module_provider.get_user_roles.find { |role| role['users']....
json.array!(@cards) do |card| json.extract! card, :id, :image_url, :offense, :defense json.url card_url(card, format: :json) end
# encoding: utf-8 RSpec.describe TTY::File, '#prepend_to_file' do it "appends to file" do file = tmp_path('Gemfile') TTY::File.prepend_to_file(file, "gem 'tty'\n", verbose: false) expect(File.read(file)).to eq([ "gem 'tty'\n", "gem 'nokogiri'\n", "gem 'rails', '5.0.0'\n", "gem 'ra...
require 'minitest/autorun' require "./game.rb" require "./core/string.rb" require "./core/controller_old.rb" class ControllerOldTest < Minitest::Spec include ControllerOld def setup set_language "pt" start_controller end def test_is_get assert is "pega", :get assert is "pegar", :get asser...
require "rails_helper" describe Permission, type: :model do it "should find matching permissions with or without context" do context_id = "1234" permission = create(:permission) permission1 = create(:permission, context_id: context_id) permission2 = create(:permission, context_id: "asdf1234") per...
class Clients::LandingController < Clients::BaseController before_action :authenticate_client!, :check_reset_password def index end private def check_reset_password redirect_to edit_client_registration_path if current_client.reset_password end end
class StoreSolutionsController < ApplicationController skip_before_action :authorize include CurrentCart before_action :set_cart def index per_page = 20 @inner_window = 1 @outer_window = 1 @solutions = Solution.order('created_at DESC').paginate(page: params[:page],\ per_page: per_page) ...
# Encoding: UTF-8 require_relative '../spec_helper' require_relative '../../libraries/provider_kindle_app_mac_os_x_direct' describe Chef::Provider::KindleApp::MacOsX::Direct do let(:name) { 'default' } let(:run_context) { ChefSpec::SoloRunner.new.converge.run_context } let(:new_resource) { Chef::Resource::Kindl...
module KMP3D module KMPImporter module_function Group = Struct.new(:range, :id) def import(path=nil, silent=false) if Data.entities.any? { |ent| ent.kmp3d_object? } msg = "KMP3D points were found in the current model. " \ "Would you like to overwrite them?" Data.erase...
require 'temperature' describe Temperature do it 'show temperature' do file = File.dirname(__dir__) + '/spec/fixtures/temperature.xml' xml = File.read(file) doc = REXML::Document.new(xml) temperature = Temperature.temperature_from_xml(doc) expect(temperature).to eq 1 end end
require 'test_helper' class E1ubicacionsControllerTest < ActionDispatch::IntegrationTest setup do @e1ubicacion = e1ubicacions(:one) end test "should get index" do get e1ubicacions_url assert_response :success end test "should get new" do get new_e1ubicacion_url assert_response :success ...
require 'spec_helper' describe Cloud do context "Currency" do before(:all) do @cloud = given_resources_for([:cloud])[:cloud] end it "should allow a change to a valid currency" do @cloud.billing_currency = 'GBP' @cloud.save.should == true @cloud.errors.count.should ...
require 'rails_helper' describe Channel do describe :factory do it { expect(build(:channel)).to be_valid } end describe :fetch_all do let(:channels) do [ { group_id: 1, group_name: 'group_1', channel_id: 1, name: 'channel_1' }, { group_id: 1, group_name: 'group_1', channel_id: 2, n...
FactoryGirl.define do password = Faker::Internet.password factory :user do first_name Faker::Name.first_name last_name Faker::Name.last_name email Faker::Internet.email password password password_confirmation password end end
module Taobao class Model def initialize(options) options.each_pair do |key, value| self.try("#{key}=", value) end end def self.fields attr_names.join(",") end end end
require "integration_test_helper" require "gds_api/test_helpers/mapit" require "gds_api/test_helpers/local_links_manager" class FindLocalCouncilTest < ActionDispatch::IntegrationTest include GdsApi::TestHelpers::Mapit include GdsApi::TestHelpers::LocalLinksManager setup do content_store_has_random_item(base...
class CreateNotifications < ActiveRecord::Migration[5.2] def change create_table :notifications do |t| t.integer :cook_id t.integer :cook_comment_id t.integer :visiter_id, null: false t.integer :visited_id, null: false t.string :action, default: '', null: false t.boolean :check...
class Api::V1::ItemsController < ApplicationController def index render :json List.find(params[:id]).items end def create render :json Item.create(list_params) end def update render :json Item.update(params[:id], list_params) end def show render :json Item.find(params[:id]) end de...
require 'rails_helper' RSpec.feature "User view a list of all playlists" do scenario "they see a page with links to all playlists' pages" do playlists = [] 2.times do playlists << create(:playlist) end visit playlists_path playlists.each do |playlist| expect(page).to have_link pla...
class K0100a attr_reader :title, :options, :name, :field_type, :node def initialize @title = "Section K: Swallowing/Nutritional Status" @name = "Swallowing Disorder: Does resident have loss of liquids/solids from mouth when eating or drinking? (K0100a)" @field_type = RADIO @node = "K0100A" @op...
## #Author: Benjamin Walter Newhall 12/17/19, github: bennewhall #Explanation: A class that will either return the ending type of an ast, or throw an error with metadata information about error position #Usage: v = Validator.new(typesource) (typesource is a TypeSources object) # v.validate(ast) ...
class Ants::Colony::Entity attr_accessor :x, :y, :grid, :type # type = E for empty # A for ant # I for item # B for both (ant carrying an item) def initialize grid, x = nil, y = nil @grid, @x, @y = grid, x, y @type = 'E' end def to_s "#{x},#{y} | #{type}" end end