Class: Mocha::ParameterMatchers::QueryStringMatches

Inherits:
Base
  • Object
show all
Defined in:
lib/mocha/parameter_matchers/query_string.rb

Overview

Parameter matcher which matches URIs with equivalent query strings.

Instance Method Summary collapse

Methods inherited from Base

#&, #to_matcher, #|

Constructor Details

#initialize(uri) ⇒ QueryStringMatches



33
34
35
# File 'lib/mocha/parameter_matchers/query_string.rb', line 33

def initialize(uri)
  @uri = URI.parse(uri)
end

Instance Method Details

#matches?(available_parameters) ⇒ Boolean



38
39
40
41
42
# File 'lib/mocha/parameter_matchers/query_string.rb', line 38

def matches?(available_parameters)
  actual = explode(URI.parse(available_parameters.shift))
  expected = explode(@uri)
  actual == expected
end

#mocha_inspectObject



45
46
47
# File 'lib/mocha/parameter_matchers/query_string.rb', line 45

def mocha_inspect
  "has_equivalent_query_string(#{@uri.mocha_inspect})"
end