Module: Facon::Baconize::ShouldExtensions
- Defined in:
- lib/facon/baconize.rb
Overview
Mixin intended for Bacon’s Should class so that we can do mock.should.receive(:message) and mock.should.not.receive(:message).
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
65 66 67 68 69 70 71 72 73 |
# 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 |
Instance Method Details
#receive(method, &block) ⇒ Object
75 76 77 78 79 80 81 82 |
# 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 |