module Facon::Baconize::ShouldExtensions
Mixin intended for Bacon’s Should class so that we can do mock.should.receive(:message) and mock.should.not.receive(:message).
Public Class Methods
Source
# File lib/facon/baconize.rb, line 65 def self.included(base) # Remove Facon::Mockable methods we mixed in to Object, since we don't # need those in the Should class. base.class_eval do instance_methods.each do |method| undef_method(method) if Facon::Mockable.public_instance_methods.include?(method) end end end
Public Instance Methods
Source
# File lib/facon/baconize.rb, line 75 def receive(method, &block) Bacon::Counter[:requirements] += 1 # A should.receive expectation is also a Bacon requirement. if @negated @object.mock_proxy.add_negative_expectation(caller(1)[0], method, &block) else @object.mock_proxy.add_expectation(caller(1)[0], method, &block) end end
Private Instance Methods
Source
# File lib/facon/baconize.rb, line 85 def mock_proxy @mock_proxy ||= Proxy.new(@object, Mock === @object ? @object.name : @object.class.name) end