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

included(base) click to toggle 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

receive(method, &block) click to toggle 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

[Validate]

Generated with the Darkfish Rdoc Generator 2.