Sha256: 28bda9f895733f3c1c85c48b608ef447ecedc33700ccd5bbdf6859bb1c667236

Contents?: true

Size: 910 Bytes

Versions: 14

Compression:

Stored size: 910 Bytes

Contents

module RR
  module Integrations
    module RSpec
      class InvocationMatcher < SpyVerificationProxy
        attr_reader :failure_message, :spy_verification_proxy

        def initialize(method = nil)
          @verification = nil
          @subject = nil
          method_missing(method) if method
        end

        def matches?(subject)
          @verification.subject = subject
          calls = RR::Space.instance.recorded_calls
          if error = calls.match_error(@verification)
            @failure_message = error.message
            false
          else
            true
          end
        end

        def nil?
          false
        end

        def method_missing(method_name, *args, &block)
          if @verification
            @verification.send(method_name, *args)
          else
            @verification = super
          end
          self
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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