text
stringlengths
10
2.61M
require File.join(File.dirname(__FILE__), '..', 'spec_helper') describe "Twitter::ClassUtilMixin mixed-in class" do before(:each) do class TestClass include Twitter::ClassUtilMixin attr_accessor :var1, :var2, :var3 end @init_hash = { :var1 => 'val1', :var2 => 'val2', :var3 => 'val3' } end ...
class UserPostLikesController < ApplicationController def create @user_post_like = UserPostLike.where(user_id: params[:user_id], post_id: params[:post_id] ).first # If the user has not liked the post, allow them to like it if @user_post_like.nil? UserPostLike.create!(user_id: params[:user_id], post...
require 'spec_helper' require_relative '../../lib/paths' using StringExtension module Jabverwock using StringExtension RSpec.describe 'jw basic test' do subject(:inp) { INPUT.new } it "templeteString is nothing" do pr = Press.new pr.initResutString expect(pr.resultString).to eq "...
class AddTimeLimitToBenefits < ActiveRecord::Migration def change add_column :benefits, :time_limit, :integer add_column :benefits, :time_periode, :string end end
require_relative 'cell' require_relative 'core_extensions' module TicTacToe class Board attr_reader :grid def initialize input = {} @grid = input.fetch(:grid, default_grid) end def get_cell x, y @grid[y][x] end def set_cell x, y, value get_cell(x, y).value = value ...
class LockersController < ApplicationController before_action :set_locker, only: [:receipt] # GET def reservation @avaliable_small_lockers_count = Locker.avaliable_small_lockers_count @avaliable_medium_lockers_count = Locker.avaliable_medium_lockers_count @avaliable_large_lockers_count = Locker.avali...
# == Schema Information # # Table name: solutions # # id :integer not null, primary key # user_id :integer # challenge_id :integer # status :integer # created_at :datetime not null # updated_at :datetime not null # attempts :integer # properties :hstore # ...
module Chianna class Application attr_reader :routes include Chianna::Helpers def initialize @components = [] @routes = {} end def map(component, *routes) @components << component routes.each do |route| @routes[route] = component end ...
#!/usr/bin/env ruby $LOAD_PATH.unshift( File.expand_path( File.dirname( __FILE__ ) + "/../../lib/" ) ) require "blocker" require "lucie/script" require "command/node-update" Lucie::Log.path = File.join( Configuration.log_directory, "node-update.log" ) def target_nodes nodes= [] ARGV.each do | each | bre...
require 'rails_helper' RSpec.describe Section, type: :model do it { should belong_to(:menu) } it { should have_many(:items) } end
require 'spec_helper' describe MoneyMover::Dwolla::Passport do let(:number) { double 'number' } let(:country) { double 'country' } let(:attrs) do { number: number, country: country } end subject { described_class.new(attrs) } it { should validate_presence_of(:number) } it { should v...
# coding: utf-8 # frozen_string_literal: true # This file is part of IPsec packetgen plugin. # See https://github.com/sdaubert/packetgen-plugin-ipsec for more informations # Copyright (c) 2018 Sylvain Daubert <sylvain.daubert@laposte.net> # This program is published under MIT license. module PacketGen::Plugin class...
class Link < ApplicationRecord validates :original_url, presence: true, url: true end
require 'spec_helper' describe "Subscriptions" do describe "GET /subscriptions" do let!(:subscription) { Factory(:subscription) } before(:each) do visit subscriptions_path end it "should be successful" do page.should have_content("Listing subscriptions") end it "should have a li...
require 'grit' include Grit class GitDriver COMMIT_COUNT = 9999999999 def self.commits(repository, branch) repo = Repo.new(repository) repo.commits(branch, COMMIT_COUNT) end end
class CreateRequestsWithdraws < ActiveRecord::Migration def self.up create_table :requests_withdraws do |t| t.decimal :amount, :default => 0.0, :precision => 8, :scale => 2 t.string :state t.integer :transaction_id t.timestamps null: false end add_index :requests_withdraws, :transac...
require 'test/test_helper' class EmailsControllerTest < ActionController::TestCase fixtures :users def setup @controller = EmailsController.new @request = ActionController::TestRequest.new @response = ActionController::TestResponse.new @emails = ActionMailer::Base.deliveries @emails.clear en...
class MethodDeclaration < ASTNode def klass @klass ||= parents(:of_class => ClassDeclaration).first end def parameters @parameters ||= @children.select { |i| i.class == MethodParameterDeclaration } end def return_type return children_filtered(:of_class => ReturnTypeDeclaration).first end ...
class Relationship < ActiveRecord::Base belongs_to :user belongs_to :following, class_name: 'User' validates_uniqueness_of :user, scope: :following validate :cannot_follow_self private def cannot_follow_self if user_id == following_id errors.add(:following_id, "can't follow yourself") end ...
require "cinch/configuration" module Cinch # @since 1.2.0 class BotConfiguration < Configuration KnownOptions = [:server, :port, :ssl, :password, :nick, :nicks, :realname, :user, :verbose, :messages_per_second, :server_queue_size, :strictness, :message_split_start, :mess...
require 'rails_helper' RSpec.describe 'Merchant Item Update', type: :feature do before :each do @merchant = create(:merchant) @items = create_list(:item,2, user: @merchant) @inactive_item = create(:inactive_item, user: @merchant) allow_any_instance_of(ApplicationController).to receive(:current_user...
module MathOpt class LineParser def initialize @parser = nil end def parse line @parser = ConstraintParser.new if ConstraintParser::LINE_RECOGNITION.any? { |a| line.include? a } @parser = ObjectiveParser.new if ObjectiveParser::LINE_RECOGNITION.any? { |a| line.include? a } raise...
# frozen_string_literal: true require_relative "swagger/topics_controller" class Api::V1::TopicsController < ApplicationController before_action :set_topic, only: %i(show update destroy) skip_before_action :authenticate_user, only: %i( index show ) include Swaggable def index topics = Topic.includes(:use...
require "minitest_helper" require "stringio" require "airbrussh/configuration" require "airbrussh/console_formatter" # ConsoleFormatter is currently tested via a comprehensive acceptance-style # test in Airbrussh::FormatterTest. Hence the lack of unit tests here, which # would be redundant. class Airbrussh::ConsoleFor...
FactoryBot.define do factory :card do original_text { 'home' } translated_text { 'дом' } image { Rack::Test::UploadedFile.new(Rails.root.join('spec/support/logo_image.jpg'), 'image/jpeg') } end end
class Dashboard::Diabetes::TreatmentOutcomesCardComponent < ApplicationComponent attr_reader :data attr_reader :region attr_reader :period attr_reader :with_ltfu def initialize(data:, region:, period:, with_ltfu: false) @data = data @region = region @period = period @with_ltfu = with_ltfu e...
FactoryGirl.define do factory :banglore_city, class: City do |c| c.name "banglore" c.state_code 'BL' c.country_code "IN" end end
require 'formula' class Cpulimit < Formula homepage 'https://github.com/opsengine/cpulimit' url 'https://github.com/opsengine/cpulimit/archive/v0.1.tar.gz' sha1 'b7c16821a3e04698b79b28905b68b8c518417466' head 'https://github.com/opsengine/cpulimit.git' def install system 'make' bin.install 'src/cpu...
class CreateWebsitePages < ActiveRecord::Migration def change create_table :website_pages do |t| t.string :title t.text :body_markdown t.text :body_html t.references :website t.string :path t.timestamps end add_index :website_pages, :website_id end end
class Shuttle::API end class Shuttle::API::Request attr_accessor :method attr_accessor :endpoint attr_accessor :body def fire! request_counter = 0 begin uri = URI.parse("#{Shuttle::API::BaseURI}#{self.endpoint}") http = Net::HTTP.new(uri.host, uri.port) case self.method when '...
# Match AWS_SECRET_ACCESS_KEY class MatchesAwsSecretAccessKey def self.===(item) item.include?('AWS_SECRET_ACCESS_KEY') end end
class FormatEXH < FormatECH def initialize(time=nil) super(time) @ban_list = BanList["elder custom highlander"] end def format_pretty_name "Elder XMage Highlander" end def legality(card) status = super(card) if status == "legal" or status == "restricted" unless card.xmage?(@time) ...
class Dog < ActiveRecord::Base has_many :ownersdog has_many :owners, through: :ownersdog validates_presence_of :name end
class CreateOfferings < ActiveRecord::Migration def change create_table :offerings do |t| t.string :zip_code t.string :offer_category t.decimal :cost t.string :cost_basis t.text :description t.references :user, index: true t.timestamps end end end
require 'gtk3' class DialogExample < Gtk::Dialog def initialize(parent) super(title: 'My Dialog', parent: parent, flags: :destroy_with_parent, buttons: [[Gtk::Stock::CANCEL, :cancel], [Gtk::Stock::OK, :ok]]) self.default_width = 150 self.default_height = 100 label = Gtk::Label.new 'This i...
class PortfolioItem < ActiveRecord::Base belongs_to :specialist has_one :photo_collection, as: :imageable, include: :photos delegate :specialist_group, :specialization, to: :specialist delegate :preview_photo, to: :photo_collection accepts_nested_attributes_for :photo_collection, allow_destroy: true ext...
class Api::Issues::DestroyOp class << self def execute(id) issue = ::Issue.find(id) issue.destroy! issue end def allowed?(current_user, id) current_user.regular? && ::Issue.find(id).author == current_user end end end
class CreateCalculationParameters < ActiveRecord::Migration def change create_table :calculation_parameters do |t| t.integer :stock_id t.integer :calculation_algorithm_id t.decimal :price t.decimal :percentage t.integer :quantity t.integer :period t.timestamps null: fals...
require_relative '../test_helper' class AdminMailerTest < ActionMailer::TestCase test "should send download link" do p = create_project requestor = create_user email = AdminMailer.send_download_link(:csv, p, random_url, requestor.email, 'password') assert_emails 1 do email.deliver_now end ...
FactoryGirl.define do factory :public_post, class: Post do title { Faker::Lorem.sentence } content { Faker::Markdown.random } post_status 'posted' posted_at { Time.zone.yesterday + 6.hours } association :user image { Rack::Test::UploadedFile.new(File.open(File.join(Rails.root, '/spec/support/p...
require 'test/unit' require 'tb/cmdtop' require 'tmpdir' class TestTbCmdUnnest < Test::Unit::TestCase def setup Tb::Cmd.reset_option @curdir = Dir.pwd @tmpdir = Dir.mktmpdir Dir.chdir @tmpdir end def teardown Tb::Cmd.reset_option Dir.chdir @curdir FileUtils.rmtree @tmpdir end def...
class ReviewsController < ApplicationController before_action :authenticate_user!, only: [:new, :create] def create @review = Review.new(review_params) @booking = Booking.find(params[:booking_id]) authorize @review if @review.save @booking.review = @review @booking.save redirect_...
class Array def include_array? array self.any?{|x| array.include?(x)} end end
require 'spec_helper' require 'date' describe Boxzooka::InboundCancellationRequest, :requests do let(:catalog_request) { Boxzooka::CatalogRequest.new(items: [item]) } let(:inbound_request) do Boxzooka::InboundRequest.new( po: inbound_po_name, items: [inbound_item], carrier: 'FEDEX', e...
require 'clustering/genetic_error_clustering2' require 'clustering/spectral_clustering' # This module implements the clustering algorithms for the demo module ClusteringModule def self.algorithms { energy_type: { string: 'By renewable type', proc: ->(k) { run_energy_type k } ...
#Sabiendo que "a.next" => b y "b.next" => c. Crear un programa llamado gen.rby quecontenga un método llamado gen que reciba el número de letras a generar y devuelva un string contodas las letras generadas concatendas. n = ARGV[0].to_i def gen(number) letter = 'a' string = '' number.times do ...
class CreateProjects < ActiveRecord::Migration def change create_table :projects do |t| t.integer :academic_id t.string :number t.string :title t.text :description t.text :requirements t.text :resources t.integer :total_students t.timestamps end end end
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{iso_countries} s.version = "0.2" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Jeremy Weiskotten"] s.date = %q{2009-08-03} s.email = %q{jeremy@weiskotten.com} s.ext...
#!/usr/bin/env ruby # This will return CVE references in the given PDF file. Alternatively, # you can pipe text to STDIN for the same magic. require "rubygems" require "pdf-reader" class CVEExtractor attr_reader :cves def initialize() @nextline = nil @prevline = nil @cves = [] end def extract_cv...
require "aethyr/core/actions/commands/ainfo" require "aethyr/core/registry" require "aethyr/core/input_handlers/admin/admin_handler" module Aethyr module Core module Commands module Ainfo class AinfoHandler < Aethyr::Extend::AdminHandler def self.create_help_entries help_entr...
class BootstrapColDecorator def initialize(col_md) @col_md = col_md.to_i end def to_class self.to_i > 0 ? "col-md-#{@col_md.to_i}" : '' end def to_offset_class self.to_i > 0 ? "col-md-offset-#{@col_md.to_i}" : '' end def self.padding_class(*used_space) padding_space = BootstrapColDecora...
require 'yaml' require 'nkf' module Ruboty module Gekiron module Actions class Topic < Ruboty::Actions::Base def call message.reply(gekiron_topic) rescue => e message.reply(e.message) end private def topic path = File.expand_path(ENV['...
module Travis module GithubSync class Decrypt include Encryption attr_reader :string, :key, :options def initialize(string, options) @string = string @key = options[:key] @options = options || {} end def apply return nil unless string d...
class UserInspect < ActiveRecord::Base has_many :inspects belongs_to :user validates_presence_of :user_id validates_presence_of :date_inspect end
class AddVendaIdToPartePagamento < ActiveRecord::Migration def change add_reference :parte_pagamentos, :venda, index: true, foreign_key: true end end
FactoryGirl.define do factory :game do name "Test Game" association :white_player, factory: :user association :black_player, factory: :user state "open" end factory :invalid_game, parent: :game do name nil end end
class RemoveIncidentIdFromUserAccount < ActiveRecord::Migration def change remove_column :user_accounts, :incident_id, :integer end end
class CtcpCommand def initialize(unit, options = {}) @unit = unit end def help "/#{command_and_aliases} <request> <nick> - sends the CTCP <request> to the specified nick." end def command_and_aliases c = "/#{command}" a = aliases.collect {|a| "/#{a}" } [c, a].join(' | ') end ...
class PagesController < ApplicationController def front redirect_to user_path(current_user) if logged_in? end end
require 'rails_helper' RSpec.describe AuthService::LogoutUser, type: :service do let(:user) { create(:user) } context "when logged in" do it "logouts" do user[:token] = Faker::Lorem.word expect(user.token.present?).to eq(true) expect { described_class.call(user) }.not_to raise_error e...
Given /^a Confluence page on "([^"]*)" with id (\d+):$/ do |host, id, content| # Since the command-line app runs in a difference process, we need serialize # the URLs to be stubbed @stubs ||= {} @stubs["http://#{host}/pages/editpage.action?pageId=#{id}"] = content File.open('stubs.json', 'w') do |f| ...
#! /usr/bin/env ruby # # script used to start the underwater camera tasks # require 'rock/bundles' require 'vizkit' require 'transformer' require 'transformer/sdf' require 'rock/gazebo' Rock::Gazebo.initialize Bundles.initialize view3d = Vizkit.vizkit3d_widget env_plugin = Vizkit.default_loader.send('Ocean') view3d....
class PoliticalMandatesController < ApplicationController before_action :set_political_mandate, only: [:show, :edit, :update, :destroy, :export] require './lib/pdfs/political_mandate_pdf' add_breadcrumb I18n.t('breadcrumbs.political_mandate.name'), :political_mandates_path add_breadcrumb I18n.t('breadcrumbs.po...
require_relative '../../spec_helper' RSpec.describe OpenAPIParser::SchemaValidator::IntegerValidator do let(:replace_schema) { {} } let(:root) { OpenAPIParser.parse(build_validate_test_schema(replace_schema), config) } let(:config) { {} } let(:target_schema) do root.paths.path['/validate_test'].operation(:...
class TopInvitationsController < ApplicationController include Authenticable def create @top_invitation = TopInvitation.where(email: top_invitation_params[:email]).first_or_create if @top_invitation.valid? ApplicantMailer.invitation(@top_invitation).deliver_later data = { name: "create...
Given("I am on the landing page") do navbar.visit_home_page end When("I click on the logo") do navbar.click_codebar_logo end Then("I return to the homepage") do expect(current_url).to eq('https://www.codebar.io/') end
class BookCommentsController < ApplicationController def index @new_book = Book.new @user = current_user @book = Book.find(params[:book_id]) @book_comments = @book.book_comments end def create @book_comment = BookComment.new(book_comment_params) @book_comment.user_id = current_user.id ...
class Group < ApplicationRecord has_many :user_groups has_many :users, through: :user_groups has_many :tasks, dependent: :destroy has_many :requests, dependent: :destroy has_many :chatrooms, dependent: :destroy validates :name, length: {minimum: 5} validates :course, length: {minimum: 2, maximum: 20} v...
require_relative '../../spec_helper' # Test the extensions parsing as specified in RFC 0790 module ThreeScale module Backend describe Listener do describe '.threescale_extensions' do subject { described_class } let(:simple_key) { :a_value } let(:simple_val) { '1' } let(:sim...
class Role ROLES = [ ACCOUNT_ADMIN = 'account_admin', MENU_ADMIN = 'menu_admin' ] def self.options ROLES.map do |role| [I18n.t(role, scope: 'users.available_roles'), role] end end end
# Die Class 2: Arbitrary Symbols # I worked on this challenge by myself. # I spent [1] hours on this challenge. # Pseudocode # Input: An array of strings # Output: Randomly, one of those strings # Steps: # 1: Create a class Die that takes an array of strings # 2. the "initialize" method should check to...
require 'rails_helper' describe LineupsController do add_user add_lineup context "pre-login" do describe "GET index" do it "redirects to login" do get :index expect(response).to redirect_to login_path end end end context "after-login" do before do session[:user...
require 'rails_helper' RSpec.describe Api::V1::SourcesController, type: :routing do describe 'routing' do let(:url) { 'http://lvh.me/api/v1' } let(:api_ver) { 'v1' } it 'routes to #index' do expect(:get => url + '/sources').to route_to("api/#{api_ver}/sources#index") end it 'routes to #s...
require 'test_helper' module AuthForum class EventsControllerTest < ActionController::TestCase setup do @routes = Engine.routes @user = FactoryGirl.create(:user, :name => 'nazrul') sign_in @user @event = FactoryGirl.create(:event) @product = FactoryGirl.create(:product, :price => 25...
class RFIAttachment < ActiveRecord::Base attr_accessible :filename, :s3_path, :rfi_id belongs_to :rfi, class_name: "RFI", foreign_key: "rfi_id" validates :filename, :s3_path, :rfi_id, presence: true end
require 'twilio-ruby' class Takeaway # Having a constant makes sense MENU = {:pizza => 7, :kebab => 5} # but this should have been a method DELIVERY = Time.now + 3600 #make the time look a bit nicer! e.g 19:36 for delivery. Time.now({ change }) ?? think for rails # if you have a constant, you can use i...
class Subject < ActiveRecord::Base # has_one :page has_many :pages end
class CreateGroups < ActiveRecord::Migration def change create_table :groups do |t| t.integer :user_id t.string :radius_name t.integer :group_id t.string :group_name t.string :group_desc t.boolean :active, :default => false t.boolean :admin, :default => false t.tim...
class PractitionersController < ApplicationController def index @practitioner = Practitioner.first @services = Service.all end def new if Practitioner.all.empty? @practitioner = Practitioner.new else redirect_to practitioners_path end end def create @practitioner = Pract...
class CallingAssignment < ActiveRecord::Base attr_accessible :calling_id, :person_id validates_uniqueness_of :calling_id, scope: :person_id, message: "^Cannot assign the same calling to an individual more than once." belongs_to :calling belongs_to :person end
class Restaurante < ActiveRecord::Base has_many :menus validates :nombre, presence: true end
# Advance Array in Ruby part - 4 ## Basic Block In Ruby: 3.times { |x| puts "I am currently on loop number #{x}"} 5.times do |y| square = y * y puts "The current number is #{y} and its square is #{square}" end ## Ruby Block that uses an array: candies = ["Sour Patch Kids", "Milky Way", "Airheads"] candies.each...
require 'rails_helper' describe Calculations::SavingsInvestmentRatio do it 'returns nil if required fields are missing' do calculator = instance_double( MeasureSelectionCalculator, annual_cost_savings: nil, cost_of_measure: 60_000, retrofit_lifetime: 20) sir = described_class.new( ...
# frozen_string_literal: true # A response is a response to an employment tribunal claim (ET3) class Response < ApplicationRecord belongs_to :respondent belongs_to :representative, optional: true has_many :response_uploaded_files, dependent: :destroy has_many :uploaded_files, through: :response_uploaded_files ...
require "csv" RSpec.feature "BEIS users can upload Level B activities" do let(:organisation) { create(:partner_organisation) } let!(:newton_fund) { create(:fund_activity, :newton) } let!(:ispf) { create(:fund_activity, :ispf) } let(:user) { create(:beis_user) } before { authenticate!(user: user) } before...
# # Copyright (c) 2013, 2021, Oracle and/or its affiliates. # # 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 applicabl...
#Write a method that takes a string, and returns a new string in which every #consonant character is doubled. Vowels (a,e,i,o,u), digits, punctuation, and #whitespace should not be doubled. def is_consonant?(char) ('a'..'z').include?(char.downcase) && !%w(a e i o u).include?(char) end def double_consonants(string) ...
class AddColumnNivelesToEstudiantes < ActiveRecord::Migration def change add_column :estudiantes, :basico, :boolean add_column :estudiantes, :avanzado, :boolean add_column :estudiantes, :liderato, :boolean add_column :estudiantes, :maestria, :boolean add_index :cursos, :id end end
require File.expand_path('../../../../spec_helper', __FILE__) require File.expand_path('../../fixtures/classes', __FILE__) require File.expand_path('../shared/basic', __FILE__) require File.expand_path('../shared/numeric_basic', __FILE__) require File.expand_path('../shared/integer', __FILE__) describe "Array#pack wit...
module ApplicationHelper def display_base_errors resource return '' if (resource.errors.empty?) or (resource.errors[:base].empty?) messages = resource.errors[:base].map { |msg| content_tag(:p, msg) }.join html = <<-HTML <div class="alert alert-danger alert-block"> <button type="button" class="cl...
class Api::V1::BaseController < InheritedResources::Base before_filter :ensure_login respond_to :json rescue_from ActiveRecord::RecordNotFound, with: :render_404 protected def ensure_login unless oauth_access_token render json: {errors: ['Missing access token']}, status: :unauthorized, call...
class CreateCookBooks < ActiveRecord::Migration[5.1] def change create_table :cook_books do |t| t.string :name, limit: 30, null: false t.references :added_by, references: :user, null: false t.boolean :private, null: false t.timestamps end add_index :cook_books, [:name, :added_by_id...
# -*- coding: utf-8 -*- require 'rubygems' require 'osx/cocoa' require 'yaml' require 'fileutils' require 'logger' class AppController < OSX::NSObject include OSX attr_accessor :config_path attr_reader :log attr_reader :cart attr_reader :account_database ##------------ ## Initialize ##------------ def in...
class Box attr_accessor :scale attr_accessor :position def initialize(scale = 1, position = [0, 0, 0]) @scale = scale @position = position end end class Scene attr_reader :boxes def initialize @boxes = [] @boxes << Box.new(1, [0, 0, 5]) @boxes << Box.new(2, [3, 0, 5]) @boxes << B...
# Course policy class CoursePolicy < ApplicationPolicy def index? true end def show? true end def new? user.admin? && (User.instructors.count > 0) end def create? new? end def delete? user.admin? end def edit? new? end def update? edit? end def destroy? ...
require 'delegate' class Card < Struct.new(:number, :mark) include Comparable module MARK const_set(:JORKER, :jorker) const_set(:CLOVER, :clover) const_set(:DIAMOND, :diamond) const_set(:HEART, :heart) const_set(:SPADE, :spade) end def initialize(*attributes) attributes[0] = nil if at...
# # オープンクラス # # 既存の`String`に対してメソッドを追加できる class String def to_alphanumeric gsub(/[^\w\s]/, '') end end class D def x; 'x'; end end class D # ここで再オープン def y; 'y'; end end module M class C X = 'X' end C::X # => "X" end module M Y = 'Y' end
class User < ApplicationRecord validates :name, presence: true, uniqueness: true has_many :events, foreign_key: 'creator_id', class_name: 'Event', dependent: :destroy has_many :event_attendances, foreign_key: :event_attendance_id, dependent: :destroy has_many :attended_events, through: :event_attendances h...
require 'pry' class HomeController < ApplicationController def index @map = Map.new # binding.pry return unless param_maps[:map] && param_maps[:map][:latitude] && param_maps[:map][:longitude] && param_maps[:map][:message] @map.latitude = param_maps[:map][:latitude] @map.longitude = param_maps[:ma...
require_relative './spec_helper' describe "Indent" do describe "method call with multiline hash" do indent <<-EXAMPLE callmethod({ opt1: something, opt2: another thing }) EXAMPLE it "does not mismatch" do rboo.should_not mismatch end end describe "single-line methods" d...