10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/bacon/rr.rb', line 10
def self.included(mod)
mod.send :include, RR::Adapters::RRMethods
mod.module_eval %[
alias_method :old_it, :it
def it(description, &block)
old_it(description) do
begin
# Add at least one requirement to ensure mock-only tests don't fail
Bacon::Counter[:requirements] += 1
yield
#Bacon::Counter[:requirements] -= 1 if RR.double_injections.size.zero?
RR.verify
rescue RR::Errors::RRError=>e
raise Bacon::Error.new(:failed, e.message)
ensure
RR.reset
end
end
end
]
end
|