Skip to content

Commit 4071935

Browse files
bf4GregPK
authored andcommitted
Fix test bug found by assert_nil
1 parent adf08da commit 4071935

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/adapter/json_api/include_data_if_sideloaded_test.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,25 +146,25 @@ def test_block_relationship
146146
end
147147

148148
def test_node_not_included_when_no_link
149-
expected = nil
150-
assert_relationship(:unlinked_tags, expected)
149+
expected = { meta: {} }
150+
assert_relationship(:unlinked_tags, expected, key_transform: :unaltered)
151151
end
152152

153153
private
154154

155+
def assert_relationship(relationship_name, expected, opts = {})
156+
actual = relationship_data(relationship_name, opts)
157+
assert_equal(expected, actual)
158+
end
159+
155160
def result(opts)
156161
opts = { adapter: :json_api }.merge(opts)
157162
serializable(@author, opts).serializable_hash
158163
end
159164

160-
def assert_relationship(relationship_name, expected, opts = {})
165+
def relationship_data(relationship_name, opts = {})
161166
hash = result(opts)
162-
actual = hash[:data][:relationships][relationship_name]
163-
if expected.nil?
164-
assert_nil(actual)
165-
else
166-
assert_equal(expected, actual)
167-
end
167+
hash[:data][:relationships][relationship_name]
168168
end
169169
end
170170
end

0 commit comments

Comments
 (0)