text
stringlengths
10
2.61M
require 'spec_helper' describe 'pupmod::master::sysconfig' do on_supported_os.each do |os, os_facts| before :all do @extras = { :puppet_settings => { 'master' => { 'rest_authconfig' => '/etc/puppetlabs/puppet/authconf.conf' }}} end context "on #{os}" do ['PE', 'PC1']....
module TimeTrackerCategoriesHelper class Tree attr_reader :list_root, :list, :html, :controller def initialize(array) @list_root,@list,@html,@controller = [], {}, '', 'time_tracker_categories' array.each {|e| if e.parent_id == 0 @list_root.push(e.id) else @list...
class AddSlugToMovie < ActiveRecord::Migration[5.0] def change add_column :movies, :slug, :string add_column :actors, :slug, :string add_column :characters, :slug, :string add_column :directors, :slug, :string add_column :genres, :slug, :string end end
class Band < ActiveRecord::Base attr_accessible :name, :photo validates :name, :presence => true has_many :artists has_many :recordings has_many :songs, :through => :recordings end
class CreateWorkspacesEquipmentJoin < ActiveRecord::Migration def change create_table :workspaces_equipment do |t| t.integer "workspaces_id" t.integer "equipment_id" end add_index :workspaces_equipment, ["workspaces_id", "equipment_id"] end end
namespace :lapis do namespace :client do task ruby: :environment do # Work with test environment ApplicationRecord.establish_connection(:test) ApiKey.where(access_token: 'test').destroy_all api_key = ApiKey.create! api_key.access_token = 'test' api_key.save! # Generate n...
object @product attributes :name, :description, :rating node :uri do |product| product_path product end node :price do |product| product.price.amount end
class AddCollectionTypeToMovieCollections < ActiveRecord::Migration def change add_column :movie_collectionsu, :collection_type_id, :integer end end
# frozen_string_literal: true class AdvertisementsController < ApplicationController def index @advertisements = advertisement_service(user_id: current_user.id).show_all end def show @advertisement = advertisement_service( status: true, advertisement_id: params[:id] ).show end def n...
require 'spec_helper' feature 'upload photo', %Q{ As a user I want to upload a photo So people can stalk me to my home }do #Acceptance Criteria # I am prompted for a photo # I can upload my photo from a file on my hard drive # Once the photo is uploaded, I can see a preview of the profile pic le...
require 'rails_helper' RSpec.describe CartSession do let!(:offer) { Offer.make! } let(:session) { ActionController::TestSession.new } subject { described_class.new(session) } describe 'Included concerns' do [ CartAdd, CartClean, CartList, CartRemove, ].each do |mod| it {...
require 'rails_helper' RSpec.describe Contact, type: :model do context "created with all its attributes" do user = User.create(name: "Josh") contact = Contact.new contact.first_name = "Tyler" contact.last_name = "Brewer" contact.email_address = "tylerbrewer02@gmail.com" contact.phone_number ...
require 'test_helper' class Resources::PowerBooksControllerTest < ActionController::TestCase # :nodoc: test "should default to JSON" do get :index assert_response :success assert_equal "application/vnd.application-v4+json; charset=utf-8", @response.headers["Content-Type"] end test "s...
require 'stax/aws/kms' module Stax module Kms def self.included(thor) thor.desc(:kms, 'KMS subcommands') thor.subcommand(:kms, Cmd::Kms) end end module Cmd class Kms < SubCommand no_commands do def stack_kms_keys Aws::Cfn.resources_by_type(my.stack_name, 'AWS::KM...
class EventsController < ApplicationController before_filter :init_location, :only => [:new, :create] privilege_required 'manage site', :on => :current_user, :unless => :auth_token? def index # show event cities, assume they are the densest cities @event_cities = City.min_density(City.popular_density)...
class ProductsController < ApplicationController include CommonHelper load_and_authorize_resource before_action :find_product, only: [:update, :destroy, :get_product_ajax] def index per_page = params[:per_page] ? params[:per_page].to_i : Product::PAGE_SIZE page_index = DEFAULT_PAGE_INDEX unless pa...
# frozen_string_literal: true require "dry/inflector" module Dry module Types Inflector = Dry::Inflector.new end end
# Copyright (c) 2006, 2007 Ruffdogs Software, Inc. # Authors: Adam Lebsack <adam@holonyx.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License. # # This program ...
json.array!(@flash_cards) do |flash_card| json.extract! flash_card, :id, :term, :img, :definition, :user_id json.url flash_card_url(flash_card, format: :json) end
class StimulusGenerator < Rails::Generators::Base source_root File.expand_path('templates', __dir__) argument :controller_name, type: :string, default: false argument :action_name, type: :string, default: false attr_accessor :stimulus_path, :controller_pattern def set_up @stimulus_path = "app/javascript/...
require 'test_helper' class Links::Game::HockeyVizGameOverviewTest < ActiveSupport::TestCase test "#site_name" do assert_equal "Hockey Viz", Links::Game::HockeyVizGameOverview.new.site_name end test "#description" do assert_equal "Game Overview", Links::Game::HockeyVizGameOverview.new.description end...
require 'test/test_helper' require 'build_result' class BuildResultTest < Test::Unit::TestCase def test_success_in_hash_determines_success assert BuildResult.new(:succeeded? => true).succeeded? assert_equal false, BuildResult.new(:succeeded? => false).succeeded? end def test_success_defaults_to_faile...
class CreatePens < ActiveRecord::Migration[5.2] def change create_table :pens do |t| t.string :type t.string :color t.references :student end end end
class Customer < ActiveRecord::Base has_many :cart_items, dependent: :destroy def add_product(id, product_id, quantity_ordered) cart_item =CartItem.new( customer_id: id, product_id: product_id, quantity_ordered: quantity_ordered) cart_items << cart_item #appends a value cart_item #returns a valu...
require 'test_helper' class AdmissionTest < ActiveSupport::TestCase def setup @admission = Admission.create(moment: DateTime.new(2012, 07, 11, 20, 10, 0)) @patient = Patient.create(first_name: "Mr", middle_name: "Doctor", last_name: "Strange", dob: DateTime.now, gender: "male") @diagnoses = Diagnosis.cre...
class CreateSpeaks < ActiveRecord::Migration[5.2] def change create_table :speaks do |t| t.text :text t.string :field t.string :subject t.integer :st_user_id t.timestamps end end end
module Cms::CrudFilter extend ActiveSupport::Concern include SS::CrudFilter included do menu_view "cms/crud/menu" before_action :set_item, only: [:show, :edit, :update, :delete, :destroy, :lock, :unlock] end private def append_view_paths append_view_path "app/views/ss/crud" append_vi...
class Provider < ActiveRecord::Base has_many :product_providers, dependent: :destroy has_many :products, through: :product_providers has_many :stock_provisions validates :nom, presence: true validates :reference, presence: true accepts_nested_attributes_for :product_providers, :allow_destroy => true end
class Player attr_accessor :name, :choice def initialize(name, choice) @name = name @choice = choice end end
require_relative '../../lib/modules/method_missing' ### # # CreditDecorator # # Adds display logic to the credit business object. # # Used by payment decorator . # ## # class CreditDecorator include ActionView::Helpers::NumberHelper include MethodMissing include NumberFormattingHelper def credit @source ...
class ExtrasController < ApplicationController before_action :set_extra, only: [:show, :edit, :update, :destroy] before_action :form_variables, only: [:new, :edit, :create, :update] # GET /extras # GET /extras.json def index @extras = Extra.all end # GET /extras/1 # GET /extras/1.json...
class SearchesController < ApplicationController def search begin return render json: "Please enter query", status: 400 unless request.query_parameters['query'] query = request.query_parameters['query'] @movies = Movie.search_movie_title(query) @news = News.search_news_content(query) ...
class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :validatable # user will have many listings to sell so user w...
class ApplicationController < ActionController::Base protect_from_forgery before_filter :setup def setup # Mailchimp API Key @mailchimp_api_key = 'API_KEY' # This site's domain name, including the www. if required (ie: google.com): @sitedomain = 'DOMAIN.TLD' # Title tag for the site: @...
class ProductMailer < ApplicationMailer # Subject can be set in your I18n file at config/locales/en.yml # with the following lookup: # # en.product_mailer.product_deleted.subject # def product_deleted product, orders @product = product @orders = orders mail to: "huatam391@gmail.com", sub...
class CourseStudent < ApplicationRecord validates_presence_of :grade belongs_to :student belongs_to :course def name Student.find(self.student_id).name end end
# frozen_string_literal: true require 'ipaddr' ## # Holds helper methods for friendly resources view template. module FriendlyResourcesHelper # @return [String] def friendly_resource_name(friendly_resource) return friendly_resource.name if friendly_resource 'Unknown' end # @return [String] def fri...
require 'acfs/service/middleware' module Acfs # @api private # class Runner include Service::Middleware attr_reader :adapter def initialize(adapter) @adapter = adapter @running = false end # Process an operation. Synchronous operations will be run # and parallel operations w...
class AddTeamLogos < ActiveRecord::Migration[5.2] def change add_column(:teams, :svglogo, :text) remove_column(:teams, :created_at, :datetime) remove_column(:teams, :updated_at, :datetime) end end
require "spec_helper" describe App do include Rack::Test::Methods def app App end describe "heartbeat" do it "should return 'Alive'" do get "/status/heartbeat" last_response.ok?.should be_true last_response.body.should == "Alive" end end describe "db" do before do ...
class Step < ApplicationRecord belongs_to :level has_many :questions def self.first_step where(order: 0, level_id: Level.first_level.id).first end def next level.steps.find { |s| s.order == order + 1 } end end
class Combustible < ActiveRecord::Base attr_accessible :nombre has_many :precio def to_s self.nombre end def self.find_by_slug slug Combustible.all.detect { |c| c.slug == slug } end def self.find_by_id_or_slug id_or_slug combustible = Combustible.find_by_slug(id_or_slug) combustible.ni...
require 'bundler' Bundler::GemHelper.install_tasks task :default => :test require 'rake/testtask' Rake::TestTask.new do |t| t.pattern = "test/*_test.rb" end begin require 'rocco/tasks' require 'rake/clean' Rocco::make 'docs/' desc 'Build rocco docs' task :docs => :rocco directory 'docs/' desc 'Bui...
# encoding: utf-8 # 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' }]) # Ma...
class PartialRendererGenerator < Rails::Generator::NamedBase def initialize(runtime_args, runtime_options = {}) super if runtime_args[0] == 'go' options[:file_name] = 'pagination' else options[:file_name] = runtime_args[0] end if options[:format].nil? options[:format] = 'haml'...
class CreateCourses < ActiveRecord::Migration def change create_table :courses do |t| t.string :name t.string :by t.references :courses_site, index: true, foreign_key: true t.integer :rating t.integer :complete t.text :description t.text :learnt t.timestamps null: ...
require 'test_helper' require 'mocha' class FacebookerQueueWorkerTest < ActiveSupport::TestCase context 'a FacebookerQueueWorker instance' do setup do @worker = FacebookerQueueWorker.new end context 'calling #facebooker_session' do should 'return a Facebooker::CanvasSession instance' do ...
class Fixnum def closest_fibonacci raise "Can only calculate closest fibonacci of number > 0" if self <= 0 find_fibonacci(self) end private @fibonacci_sequence = [0, 1] class << self attr_accessor :fibonacci_sequence end def find_fibonacci(num) best_fibonacci = -1 best_fibonacc...
# frozen_string_literal: true # Challange 1 require('json') require('net/http') # class users request # @author Elton Fonseca class UsersRequest def initialize @file = File.open('users.json', 'w') @uri = URI('https://reqres.in/api/users') @total_pages = json_to_object(_request(@uri)).total_pages end ...
class CreatingASurveyForUserContext < ApiBaseContext def initialize(user, params) super(user) @params = params end def execute survey = Survey.new(params_for_survey) survey.save survey end private def params_for_survey @params. require(:survey). permit(:checklist_id, c...
###################################################### # Example usage - since this is in PMApplication ###################################################### # app.alert(title: "Hey There", message: "Want a sandwich?") do |choice| # case choice # when "OK" # mp "Here's your sandwich" # when "Cancel" # mp...
require 'test_helper' class UsersSignupTest < ActionDispatch::IntegrationTest def setup @user_data = {username: "waeiawe", email: "foo.bar@baz.qux", password: "iamatestpassword1", password_confirmation: "iamatestpassword1"} end test "valid signup information" do get signup_path assert_difference 'U...
require './lib/atm.rb' require 'date' require 'pry-byebug' describe Atm do let(:account) { instance_double('Account', pin_code: '1234', exp_date: '04/2017', account_status: :active ) } before do allow(account).to receive(:balance).and_return(100) allow(account).to receive(:balance=)...
class FluentdUiRestartJob < ApplicationJob queue_as :default LOCK = [] def lock! raise "update process is still running" if locked? LOCK << true # dummy value end def locked? LOCK.present? end def unlock! LOCK.shift end def perform lock! # NOTE: install will be failed bef...
require 'vlad' include Rake::DSL # @author Joshua P. Mervine <joshua@mervine.net> # # Please see {file:lib/vlad/push.rb Vlad::Push Source} for Rake task documentation. class Vlad::Push VERSION = "1.1.2" # @attribute[rw] # init Vlad::Push set :source, Vlad::Push.new # @attribute[rw] # set default reposito...
class ClubsController < ApplicationController def all @clubs = Club.all end def one @club = Club.find_by(id: params[:id]) @players = Player.where(club_id: params[:id]) @players_by_level = @players.group_by{|player| player.level} raise ActionController::RoutingError.new('Not Found') if @club.nil? e...
class Registration < ApplicationRecord belongs_to :user, :optional => true belongs_to :event end
require 'rails_helper' describe 'company contacts' do scenario 'user can see a field for contact input on company page' do company = Company.create!(name: "Evil Industries") category = Category.create!(title: "World Domination") job = Job.create!(title: "Henchman 1", description: "Disposable Meat", level...
require 'pry' class Node class EmptyNode < Node def initialize @value = nil end end attr_accessor :value, :next_node def initialize(initial) @value = initial @next_node = EmptyNode.new end def to_s string = "#{value}\n" string += next_node.to_s unless tail? string end...
require 'spec_helper' require 'lib' module Prct06 class Libro describe Prct06::Libro do before :each do @libro = Libro.new "autor","titulo","editorial", "edicion", "fecha", :isbn end describe "#new" do it "Introduce parametros y retorna un objeto tipo Libro" do @Libro.should be_an_instance_of ...
class Post < ActiveRecord::Base has_many :comments belongs_to :user default_scope { order('created_at DESC') } scope :ordered_by_title, -> { reorder(title: :asc) } scope :ordered_by_reverse_created_at, -> { reorder('created_at DESC') } end
class AddSubContentToIdeas < ActiveRecord::Migration[5.2] def change add_column :ideas, :sub_content, :string end end
cookbook_file "/etc/prometheus/alertmanager.yml" do owner "prometheus" group "prometheus" end prometheus_alertmanager "Test Kitchen" do action :create version '0.20.0' uri 'https://github.com/prometheus/alertmanager/releases/download/v0.20.0/alertmanager-0.20.0.linux-amd64.tar.gz' checksum '3a826321ee90a507...
# comment require_relative 'wagon' class CargoWagon < Wagon def initialize(name, volume) super('cargo', name) @volume = volume @reserved_space = 0 validate! end attr_reader :reserved_space, :volume def reserve_space(value) raise 'превышен объем вагона' if reserved_volume + value > volume ...
# frozen_string_literal: true require 'sinatra' require 'discordrb' require 'json' module RubotHandlers; end $handlers = {} # Method to load handlers def deploy! # Load all the module code files. Dir.glob('handlers/*.rb') { |mod| load mod } RubotHandlers.constants.each do |name| const = RubotHandlers.con...
require 'pry' =begin // --- Directions // Write a function that returns the number of vowels // used in a string. Vowels are the characters 'a', 'e' // 'i', 'o', and 'u'. // --- Examples // vowels('Hi There!') --> 3 // vowels('Why do you ask?') --> 4 // vowels('Why?') --> 0 =end module Vowels VOWELS = %w[a e...
action :create do user 'prometheus' do system true shell '/bin/false' home new_resource.home_dir end directory new_resource.home_dir do action :create recursive true mode 0755 owner 'prometheus' group 'prometheus' end directory new_resource.home_dir + '/bin' do action :crea...
Puppet::Type.newtype(:f5_node) do @doc = "Manage F5 node." apply_to_device ensurable do defaultvalues defaultto :present end newparam(:name, :namevar=>true) do desc "The node name." validate do |value| unless Puppet::Util.absolute_path?(value) fail Puppet::Error, "Node names ...
require "pry" class Guest attr_reader :name @@all = [] def initialize(name) @name = name @@all << self end def listings #array of all listings guest has stayed at Trip.all.select do |trip| trip.guest == self end end def trips ...
helpers do def get_bib_entry(bib_key) bib_hash = {} entry = $bib[bib_key] # Paper or talk title, minus the {forced capitalization} required for bibtex bib_hash[:title] = entry.title.delete "{}" # Stacked list of authors separated by linebreaks bib_hash[:authors] = entry.author.length == 1 ?...
require 'rails_helper' RSpec.describe WfsRails::WorkflowParser do include XmlFixtures let(:druid) { 'druid:abc123' } let(:repository) { 'dor' } let(:wf_parser) { described_class.new(workflow_create, druid, repository) } describe '#create_workflows' do it 'creates a workflow for each process' do ex...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) Gem::Specification.new do |gem| gem.name = "imdb-party" gem.version = "1.1" gem.authors = ["John Maddox", "Mike Mesicek"] gem.email = ["jon@mustacheinc.com"] gem.de...
class CreateDeals < ActiveRecord::Migration def change create_table :deals do |t| t.integer :deal_id t.string :user_name t.integer :category t.binary :photo1 t.binary :photo2 t.binary :photo3 t.binary :photo4 t.string :title t.text :explanation t.timest...
require 'machinist/active_record' # Best Practices: #- Keep blueprints minimal #- If you want to construct a whole graph of connected objects, do it outside of a blueprint #- Sort your blueprints alphabetically AdditionalCost.blueprint do user name {"name_#{sn}"} cost_monthly_baseline {10} end ...
class FamilySerializer < ActiveModel::Serializer attributes :id, :family_name, :posts, :users has_many :posts end
require "spec_helper" describe Paperclip::Interpolations do it "returns all methods but the infrastructure when sent #all" do methods = Paperclip::Interpolations.all assert !methods.include?(:[]) assert !methods.include?(:[]=) assert !methods.include?(:all) methods.each do |m| assert Paperc...
# frozen_string_literal: true require 'digest' module Uploadcare module Param module Upload # This class generates signatures for protected uploads class SignatureGenerator # @see https://uploadcare.com/docs/api_reference/upload/signed_uploads/ # @return [Hash] signature and its expi...
class BillDetailsController < ApplicationController before_action :set_bill_detail, only: [:show, :update, :destroy] # GET /bill_details def index @bill_details = BillDetail.all render json: @bill_details end # GET /bill_details/1 def show render json: @bill_detail end # POST /bill_detai...
#DINAMICOS require "byebug" #LAMBDA #NÃO ACEITA MAIS PARAMETROS DO QUE OS DEFINIDOS #EX: 1 l = lambda do |p| #|p| funciona como uma passagem de parametro puts p end l.call("Alexandre") puts "\n" #EX: 2 l2 = lambda do |p1, p2| puts p1+p2 end l2.call(4, 5) puts "\n" #PROC #CAPTURA OS PARAMETROS POR A...
module DublinBikes class Station attr_reader :id, :address, :latitude, :longitude def initialize(marker) @id = marker.number @address = marker.address @latitude = marker.lat @longitude = marker.lng end def distance_to(m_lat, m_lng) d_lat = (@latitude - m_lat).to_rad ...
RSpec.shared_context "yammer POST" do |endpoint| let(:request_url) { "https://www.yammer.com/api/v1/#{endpoint}" } let!(:mock) { stub_request(:post, request_url).with( headers: { 'Authorization' => 'Bearer shakenn0tst1rr3d' } ). to_return( status: 201, body: {status: "ok"...
# frozen_string_literal: true class InvitationMailer < ApplicationMailer def created(invitation) @invitation = invitation @company = invitation.company mail(to: @invitation.email, subject: "Join #{@company.name} on Lunchiatto") end end
require 'rails_helper' RSpec.describe ArtsType, type: :model do before { @model = FactoryGirl.build(:arts_type) } subject { @model } it { should respond_to(:name) } it { should respond_to(:description) } it { should be_valid } it { should have_and_belong_to_many(:media_items) } it { should validate_u...
class NewPostForm include Capybara::DSL def visit_page visit '/posts' click_on('New One') self end def fill_in_with(params = {}) fill_in('Title', with: params.fetch(:title, 'Make a Post')) fill_in('Body', with: 'Post content') self end def submit click_on('Create Post') self end end
class AddUniqueIndexToTaggings < ActiveRecord::Migration[5.0] def change add_index :taggings, [:note_id, :tag_id], unique: true end end
module Admin class RolesController < ApplicationController before_action :set_admin_role, only: [:show, :edit, :update, :destroy] # POST /admin/users/1/roles/1/assign # POST /admin/users/1/roles/1/assign.json def assign respond_to do |format| status = :ok begin user ...
ActiveRecord::Base.class_eval do def self.validate_mac_address( attr_names, options={} ) validates_format_of( attr_names, { :with => /^ [0-9A-F]{2} (?: [0-9A-F]{2} ){5} $/x, :allow_blank => false, :allow_nil => false, }.merge!( options ) ) end def self.validate_ip_address( attr_n...
class EditsToPlaceTable < ActiveRecord::Migration def up change_column :places, :name, :string, null:false end def down end end
require File.dirname(__FILE__) + '/../spec_helper' describe Category do it "should be valid" do Factory.build(:category).should be_valid end it "should require a name" do Factory.build(:category, :name => '').should_not be_valid end it "should assign tickets" do tickets = [Factory(:ticket)]...
require 'rails_helper' RSpec.describe User, type: :model do context "validations" do it { should embed_many(:sessions) } it { is_expected.to have_fields(:name).of_type(String) } it { is_expected.to have_fields(:lastname).of_type(String) } it { is_expected.to have_fields(:login).of_type(String) } ...
class BooksController < ApplicationController skip_before_action :verify_authenticity_token before_action :set_book, only: %i[ show edit update destroy ] before_action :authenticate_user!, only: [:new, :create, :edit, :update, :destroy] def index @books = Book.all end def show @book = Book.find...
require 'test_helper' class CountryJpsControllerTest < ActionController::TestCase setup do @country_jp = country_jps(:one) end test "should get index" do get :index assert_response :success assert_not_nil assigns(:country_jps) end test "should get new" do get :new assert_response :s...
class TeamsController < ApplicationController def index @teams = Team.open_membership end def new @team = Team.new end def create @team = Team.new(team_params) if @team.save @team.users << current_user redirect_to team_path(@team) else render :new end end def show @team = Team.find(par...
$:.push File.expand_path('../lib', __FILE__) require 'js_tools/version' Gem::Specification.new do |s| s.name = 'js_tools' s.version = JsTools::VERSION s.authors = ['Khrebtov Roman'] s.email = ['roman@alltmb.ru'] s.homepage = 'https://github.com/Hrom512/js_tools' s.summary = 'JS ...
require 'forwardable' module Extras # A class that provides a queue-like (first-in, first-out) # structure to clients class Fifo extend Forwardable def_delegators :@store, :length def initialize @store = Array.new end # Puts an object into the queue # # @param [Object] obj ...
class ReceivableCheckSheet < ActiveRecord::Base belongs_to :user def self.to_download headers = %w(回収日 売掛金残高 Amazon残高 楽天残高 ヤフーショッピング残高 その他残高) csv_data = CSV.generate(headers: headers, write_headers: true, force_quotes: true) do |csv| all.find_each do |row| csv_column_values = [ ro...
# EventHub module module EventHub # Listner Class class ActorListener include Celluloid include Helper finalizer :cleanup def initialize(processor_instance) @actor_publisher = ActorPublisher.new_link @actor_watchdog = ActorWatchdog.new_link @connections = {} @processor_insta...
class Payroll < ActiveRecord::Base has_many :payroll_details belongs_to :worker accepts_nested_attributes_for :payroll_details, :allow_destroy => true def self.getWorker(word, name) mysql_result = ActiveRecord::Base.connection.execute(" SELECT e.id, e.name, e.second_name, e.paternal_surname, e.materna...
require 'rake' require 'rake/file_utils_ext' class SnapDeploy::Provider::Heroku < Clamp::Command SnapDeploy::CLI.subcommand 'heroku', 'deploy to heroku', self include SnapDeploy::CLI::DefaultOptions include SnapDeploy::Helpers include Rake::FileUtilsExt option '--app-name', 'APP_NAME', '...
describe SamlIdpController do render_views describe '/api/saml/logout' do it 'calls UserOtpSender#reset_otp_state' do user = create(:user, :signed_up) sign_in user otp_sender = instance_double(UserOtpSender) allow(UserOtpSender).to receive(:new).with(user).and_return(otp_sender) ...