1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
module RR
module Integrations
class RSpec2
module Mixin
def setup_mocks_for_rspec
RR.reset
end
def verify_mocks_for_rspec
RR.verify
end
def teardown_mocks_for_rspec
RR.reset
end
def have_received(method = nil)
RSpec::InvocationMatcher.new(method)
end
end
def name
'RSpec 2'
end
def applies?
defined?(::RSpec) &&
defined?(::RSpec::Core::Version::STRING) &&
::RSpec::Core::Version::STRING =~ /^2/
end
def hook
::RSpec.configure do |config|
config.mock_with Mixin
config.include RR::DSL
end
patterns =
if ::RSpec.configuration.respond_to?(:backtrace_exclusion_patterns)
::RSpec.configuration.backtrace_exclusion_patterns
else
::RSpec.configuration.backtrace_clean_patterns
end
unless patterns.include?(RR::Errors::BACKTRACE_IDENTIFIER)
patterns.push(RR::Errors::BACKTRACE_IDENTIFIER)
end
end
end
RR.register_adapter RSpec2
end
end
|