diff --git a/spec/lib/object_serializer_class_methods_spec.rb b/spec/lib/object_serializer_class_methods_spec.rb index 761900e..3c477c3 100644 --- a/spec/lib/object_serializer_class_methods_spec.rb +++ b/spec/lib/object_serializer_class_methods_spec.rb @@ -235,6 +235,7 @@ describe FastJsonapi::ObjectSerializer do before do movie.release_year = 2008 MovieSerializer.attribute :released_in_year, &:release_year + MovieSerializer.attribute :name, &:local_name end after do @@ -242,7 +243,7 @@ describe FastJsonapi::ObjectSerializer do end it 'returns correct hash when serializable_hash is called' do - expect(serializable_hash[:data][:attributes][:name]).to eq movie.name + expect(serializable_hash[:data][:attributes][:name]).to eq "english #{movie.name}" expect(serializable_hash[:data][:attributes][:released_in_year]).to eq movie.release_year end end diff --git a/spec/shared/contexts/movie_context.rb b/spec/shared/contexts/movie_context.rb index bbd89a9..9061226 100644 --- a/spec/shared/contexts/movie_context.rb +++ b/spec/shared/contexts/movie_context.rb @@ -54,6 +54,10 @@ RSpec.shared_context 'movie class' do "#{id}" end + def local_name(locale = :english) + "#{locale} #{name}" + end + def url "http://movies.com/#{id}" end