Skip to content

Commit 64f7b6c

Browse files
committed
Add spec for singular and plural, so remove same checking example.
1 parent 57f09c7 commit 64f7b6c

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

spec/lib/object_serializer_class_methods_spec.rb

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def year_since_release_calculator(release_year)
416416
subject(:serializable_hash) { MovieSerializer.new(movie).serializable_hash }
417417

418418
before do
419-
MovieSerializer.set_type :foo_bar
419+
MovieSerializer.set_type type_name
420420
MovieSerializer.set_key_transform :camel
421421
end
422422

@@ -425,8 +425,20 @@ def year_since_release_calculator(release_year)
425425
MovieSerializer.set_type :movie
426426
end
427427

428-
it 'returns correct hash which type equals transformed set_type value' do
429-
expect(serializable_hash[:data][:type]).to eq :FooBar
428+
context 'when sets singular type name' do
429+
let(:type_name) { :film }
430+
431+
it 'returns correct hash which type equals transformed set_type value' do
432+
expect(serializable_hash[:data][:type]).to eq :Film
433+
end
434+
end
435+
436+
context 'when sets plural type name' do
437+
let(:type_name) { :films }
438+
439+
it 'returns correct hash which type equals transformed set_type value' do
440+
expect(serializable_hash[:data][:type]).to eq :Films
441+
end
430442
end
431443
end
432444
end

0 commit comments

Comments
 (0)