Skip to content

Commit 6bef918

Browse files
committed
adding test that demonstrates Query::Builder#find with args doesn't work
1 parent b944c12 commit 6bef918

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/unit/query_builder_test.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,20 @@ def test_scopes_are_nondestructive
235235
assert_requested first_stub, times: 1
236236
assert_requested all_stub, times: 1
237237
end
238+
239+
def test_find_with_args
240+
first_stub = stub_request(:get, "http://example.com/articles?filter[author.id]=foo")
241+
.to_return(headers: {content_type: "application/vnd.api+json"}, body: { data: [] }.to_json)
242+
243+
all_stub = stub_request(:get, "http://example.com/articles")
244+
.to_return(headers: {content_type: "application/vnd.api+json"}, body: { data: [] }.to_json)
245+
246+
scope = Article.where()
247+
248+
scope.find( "author.id" => "foo" )
249+
scope.all
250+
251+
assert_requested first_stub, times: 1
252+
assert_requested all_stub, times: 1
253+
end
238254
end

0 commit comments

Comments
 (0)