Skip to content

Commit 9f6a391

Browse files
committed
Test requirement to correctly handle merging nested additional_params
1 parent 462e59e commit 9f6a391

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

test/unit/query_builder_test.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,16 @@ def test_can_specify_additional_params
122122
Article.with_params(sort: "foo").to_a
123123
end
124124

125+
def test_can_merge_nested_additional_params
126+
stub_request(:get, "http://example.com/articles")
127+
.with(query: {top: {foos: 1, bars: 2}})
128+
.to_return(headers: {content_type: "application/vnd.api+json"}, body: {
129+
data: []
130+
}.to_json)
131+
132+
Article.with_params(top: {foos: 1}).with_params(top: {bars: 2}).to_a
133+
end
134+
125135
def test_can_select_fields
126136
stub_request(:get, "http://example.com/articles")
127137
.with(query: {fields: {articles: 'title,body'}})

0 commit comments

Comments
 (0)