Sha256: e0161f7b582a61485b057d789859dcc36de8b6baaaaae5f6d4ae9ee12f077c30

Contents?: true

Size: 541 Bytes

Versions: 14

Compression:

Stored size: 541 Bytes

Contents

require 'spec_helper'
require File.expand_path('../../../config/initializers/active_record_extensions', __FILE__)

describe "ActiveRecord::Base", :active_record => true do
  describe "#safe_send" do
    it "only calls #read_attribute once" do
      @player = Player.new
      @player.number = 23
      original_method = @player.method(:read_attribute)
      @player.should_receive(:read_attribute).exactly(1).times do |*args|
        original_method.call(*args)
      end
      expect(@player.safe_send(:number)).to eq(23)
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
rails_admin-0.5.0 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.9 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.8 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.7 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.6 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.5 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.4 spec/rails_admin/active_record_extension_spec.rb
rails_admin-lbgraham-0.4.2 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.3 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.2 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.1 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.4.0 spec/rails_admin/active_record_extension_spec.rb
rails_admin-0.3.0 spec/unit/active_record_extension_spec.rb
rails_admin-0.2.0 spec/unit/active_record_extension_spec.rb