Sha256: 51811dc7452530850c1b4af5de2ef27e8ccd5def16e7891b11b390f1b8f38e12

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rr-3.1.1 lib/rr/integrations/rspec_2.rb
rr-3.1.0 lib/rr/integrations/rspec_2.rb
rr-3.0.9 lib/rr/integrations/rspec_2.rb
rr-3.0.8 lib/rr/integrations/rspec_2.rb
rr-3.0.7 lib/rr/integrations/rspec_2.rb
rr-3.0.6 lib/rr/integrations/rspec_2.rb
rr-3.0.5 lib/rr/integrations/rspec_2.rb
rr-3.0.4 lib/rr/integrations/rspec_2.rb
rr-3.0.3 lib/rr/integrations/rspec_2.rb
rr-3.0.2 lib/rr/integrations/rspec_2.rb
rr-3.0.1 lib/rr/integrations/rspec_2.rb
rr-3.0.0 lib/rr/integrations/rspec_2.rb
rr-1.2.1 lib/rr/integrations/rspec_2.rb
rr-1.2.0 lib/rr/integrations/rspec_2.rb