Facon::Baconize::ContextExtensions

Mixin intended for Bacon::Context so that it runs spec_verify on all mocks after each example.

Public Class Methods

included(base) click to toggle source
# File lib/facon/baconize.rb, line 33
def self.included(base)
  base.class_eval do
    alias_method :it_without_mock_verification, :it
    alias_method :it, :it_with_mock_verification
  end
end

Public Instance Methods

it_with_mock_verification(description, &block) click to toggle source
# File lib/facon/baconize.rb, line 53
def it_with_mock_verification(description, &block)
  @before.unshift(proc { setup_facon_mocks })
  @after << proc { verify_facon_mocks }
  it_without_mock_verification(description, &block)
ensure
  teardown_facon_mocks
end
setup_facon_mocks() click to toggle source
# File lib/facon/baconize.rb, line 40
def setup_facon_mocks
  $facon_mocks ||= []
end
teardown_facon_mocks() click to toggle source
# File lib/facon/baconize.rb, line 48
def teardown_facon_mocks
  $facon_mocks.each { |mock| mock.spec_reset }
  $facon_mocks.clear
end
verify_facon_mocks() click to toggle source
# File lib/facon/baconize.rb, line 44
def verify_facon_mocks
  $facon_mocks.each { |mock| mock.spec_verify }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.