Sha256: 33755cda9411668700e99d106b208d7e97f369892755e3b193c4dc5ffde62141

Contents?: true

Size: 1.53 KB

Versions: 13

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

module WebMock
  class WebMockMatcher

    def initialize(method, uri)
      @request_execution_verifier = RequestExecutionVerifier.new
      @request_execution_verifier.request_pattern = RequestPattern.new(method, uri)
    end

    def once
      @request_execution_verifier.expected_times_executed = 1
      self
    end

    def twice
      @request_execution_verifier.expected_times_executed = 2
      self
    end

    def at_least_once
      @request_execution_verifier.at_least_times_executed = 1
      self
    end

    def at_least_twice
      @request_execution_verifier.at_least_times_executed = 2
      self
    end

    def at_least_times(times)
      @request_execution_verifier.at_least_times_executed = times
      self
    end

    def with(options = {}, &block)
      @request_execution_verifier.request_pattern.with(options, &block)
      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 failure_message_when_negated
      @request_execution_verifier.failure_message_when_negated
    end

    def description
      @request_execution_verifier.description
    end

    # RSpec 2 compatibility:
    alias_method :negative_failure_message, :failure_message_when_negated
  end
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/webmock-3.23.1/lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.24.0 lib/webmock/rspec/matchers/webmock_matcher.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/webmock-3.23.1/lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.23.0 lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.22.0 lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.21.2 lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.21.1 lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.21.0 lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.20.0 lib/webmock/rspec/matchers/webmock_matcher.rb
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/webmock-3.19.1/lib/webmock/rspec/matchers/webmock_matcher.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/webmock-3.19.1/lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.19.1 lib/webmock/rspec/matchers/webmock_matcher.rb
webmock-3.19.0 lib/webmock/rspec/matchers/webmock_matcher.rb