add specs for multiple include options
This commit is contained in:
parent
267b706366
commit
5767664c8a
@ -142,12 +142,25 @@ describe FastJsonapi::ObjectSerializer do
|
|||||||
expect { MovieSerializer.new([movie, movie], options).serializable_hash }.to raise_error(ArgumentError)
|
expect { MovieSerializer.new([movie, movie], options).serializable_hash }.to raise_error(ArgumentError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'returns errors when serializing with non-existent and existent includes keys' do
|
||||||
|
options = {}
|
||||||
|
options[:meta] = { total: 2 }
|
||||||
|
options[:include] = [:actors, :blah_blah]
|
||||||
|
expect { MovieSerializer.new([movie, movie], options).serializable_hash }.to raise_error(ArgumentError)
|
||||||
|
end
|
||||||
|
|
||||||
it 'does not throw an error with non-empty string array includes key' do
|
it 'does not throw an error with non-empty string array includes key' do
|
||||||
options = {}
|
options = {}
|
||||||
options[:include] = ['actors']
|
options[:include] = ['actors']
|
||||||
expect { MovieSerializer.new(movie, options) }.not_to raise_error
|
expect { MovieSerializer.new(movie, options) }.not_to raise_error
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'does not throw an error with non-empty string array includes keys' do
|
||||||
|
options = {}
|
||||||
|
options[:include] = ['actors', 'owner']
|
||||||
|
expect { MovieSerializer.new(movie, options) }.not_to raise_error
|
||||||
|
end
|
||||||
|
|
||||||
it 'returns keys when serializing with empty string/nil array includes key' do
|
it 'returns keys when serializing with empty string/nil array includes key' do
|
||||||
options = {}
|
options = {}
|
||||||
options[:meta] = { total: 2 }
|
options[:meta] = { total: 2 }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user