Sha256: b10b5ddcef7583665aa43429ac5d8a47e9a98c5abe13d6eaaf57721255748d66

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

module WebMock
  class WebMockMatcher

    def initialize(method, url)
      @request_execution_verifier = RequestExecutionVerifier.new
      @request_execution_verifier.request_profile = RequestProfile.new(method, url)
    end

    def once
      @request_execution_verifier.expected_times_executed = 1
      self
    end

    def twice
      @request_execution_verifier.expected_times_executed = 2
      self
    end

    def with(options)
      @request_execution_verifier.request_profile.body =
        options[:body] if options.has_key?(:body)
      @request_execution_verifier.request_profile.headers = 
        options[:headers] if options.has_key?(:headers)
      self
    end

    def times(times)
      @request_execution_verifier.expected_times_executed = times.to_i
      self
    end

    def matches?(webmock)
      @request_execution_verifier.matches?
    end
    
    def does_not_match?(webmock)
      @request_execution_verifier.does_not_match?
    end

    def failure_message
      @request_execution_verifier.failure_message
    end


    def negative_failure_message
      @request_execution_verifier.negative_failure_message
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webmock-0.7.1 lib/webmock/adapters/rspec/webmock_matcher.rb