Skip to content

Commit 65e3ec3

Browse files
twsschingor13
authored andcommitted
Added missing ‘include’ to request stubs and ‘includes’ in ruby object queries. (#246)
1 parent 1f9b2b0 commit 65e3ec3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/unit/association_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ def test_load_has_many
289289
end
290290

291291
def test_load_has_many_with_multiword_resource_name
292-
stub_request(:get, "http://example.com/prefixed_owners")
292+
stub_request(:get, "http://example.com/prefixed_owners?include=prefixed_properties")
293293
.to_return(headers: {content_type: "application/vnd.api+json"}, body: {
294294
data: [
295295
{
@@ -339,7 +339,7 @@ def test_load_has_many_with_multiword_resource_name
339339
}
340340
]
341341
}.to_json)
342-
owners = PrefixedOwner.all
342+
owners = PrefixedOwner.includes(:prefixed_properties).all
343343
jeff = owners[0]
344344
assert_equal("Jeff Ching", jeff.name)
345345
assert_equal(2, jeff.prefixed_properties.length)
@@ -351,7 +351,7 @@ def test_load_has_many_with_configurable_multiword_resource_name_and_type
351351
with_altered_config(PrefixedOwner, :json_key_format => :camelized_key,
352352
:route_format => :dasherized_route) do
353353

354-
stub_request(:get, "http://example.com/prefixed-owners")
354+
stub_request(:get, "http://example.com/prefixed-owners?include=prefixed-properties")
355355
.to_return(headers: {content_type: "application/vnd.api+json"}, body: {
356356
data: [
357357
{
@@ -401,7 +401,7 @@ def test_load_has_many_with_configurable_multiword_resource_name_and_type
401401
}
402402
]
403403
}.to_json)
404-
owners = PrefixedOwner.all
404+
owners = PrefixedOwner.includes("prefixed-properties").all
405405
jeff = owners[0]
406406
assert_equal("Jeff Ching", jeff.name)
407407
assert_equal(2, jeff.prefixed_properties.length)

0 commit comments

Comments
 (0)