Skip to content

Commit 2faed77

Browse files
Adds test to ensure that query parameters are omitted from the URL when the 'options[:omit_query_params]' is passed
1 parent fbd8623 commit 2faed77

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/cases/http_mock_test.rb

+10
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ class HttpMockTest < ActiveSupport::TestCase
193193
assert_equal 2, ActiveResource::HttpMock.responses.length
194194
end
195195

196+
test "omits query parameters from the URL when options[:omit_query_params] is true" do
197+
ActiveResource::HttpMock.respond_to do |mock|
198+
mock.get("/endpoint", {}, "Response", options: { omit_query_in_path: true })
199+
end
200+
201+
response = request(:get, "/endpoint?param1=value1&param2=value2")
202+
203+
assert_equal "Response", response.body
204+
end
205+
196206
def request(method, path, headers = {}, body = nil)
197207
if method.in?([:patch, :put, :post])
198208
@http.send(method, path, body, headers)

0 commit comments

Comments
 (0)