Module: Facon::Baconize::ShouldExtensions
- Defined in:
- lib/motion-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
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/motion-facon/baconize.rb', line 67 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 [:"mock:", :"stub!:", :"should_receive:", :"should_not_receive:", :spec_verify, :spec_reset, :mock_proxy].each {|m| undef_method(m)} end end |
Instance Method Details
#receive(method, &block) ⇒ Object
81 82 83 84 85 86 87 88 |
# File 'lib/motion-facon/baconize.rb', line 81 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 |