mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Pass fields down from constructor
This commit is contained in:
committed by
Benjamin Fleischer
parent
cd9689683c
commit
be01fc8ee7
@@ -84,6 +84,20 @@ module ActiveModelSerializers
|
||||
|
||||
assert_equal(expected, actual)
|
||||
end
|
||||
|
||||
def test_fields_with_no_associations_include_option
|
||||
actual = ActiveModelSerializers::SerializableResource.new(
|
||||
[@first_post, @second_post], adapter: :json, fields: [:id], include: []
|
||||
).as_json
|
||||
|
||||
expected = { posts: [{
|
||||
id: 1
|
||||
}, {
|
||||
id: 2
|
||||
}] }
|
||||
|
||||
assert_equal(expected, actual)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user