Class: WebMock::URIStringPattern
Instance Method Summary
collapse
Methods inherited from URIPattern
#initialize
#rSpecHashIncludingMatcher?
Instance Method Details
#add_query_params(query_params) ⇒ Object
185
186
187
188
189
190
191
192
|
# File 'lib/webmock/request_pattern.rb', line 185
def add_query_params(query_params)
super
if @query_params.is_a?(Hash) || @query_params.is_a?(String)
query_hash = (WebMock::Util::QueryMapper.query_to_values(@pattern.query, :notation => Config.instance.query_values_notation) || {}).merge(@query_params)
@pattern.query = WebMock::Util::QueryMapper.values_to_query(query_hash, :notation => WebMock::Config.instance.query_values_notation)
@query_params = nil
end
end
|
#matches?(uri) ⇒ Boolean
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/webmock/request_pattern.rb', line 172
def matches?(uri)
if @pattern.is_a?(Addressable::URI)
if @query_params
uri.omit(:query) === @pattern &&
(@query_params.nil? || @query_params == WebMock::Util::QueryMapper.query_to_values(uri.query, :notation => Config.instance.query_values_notation))
else
uri === @pattern
end
else
false
end
end
|