diff --git a/spec/lib/object_serializer_spec.rb b/spec/lib/object_serializer_spec.rb index 7338047..cd6f3aa 100644 --- a/spec/lib/object_serializer_spec.rb +++ b/spec/lib/object_serializer_spec.rb @@ -361,13 +361,13 @@ describe FastJsonapi::ObjectSerializer do it 'returns optional relationship when relationship is included' do json = MovieOptionalRelationshipWithParamsSerializer.new(movie, { params: { admin: true }}).serialized_json serializable_hash = JSON.parse(json) - expect(serializable_hash['data']['relationships'].has_key?('actors')).to be_truthy + expect(serializable_hash['data']['relationships'].has_key?('owner')).to be_truthy end it "doesn't return optional relationship when relationship is not included" do json = MovieOptionalRelationshipWithParamsSerializer.new(movie, { params: { admin: false }}).serialized_json serializable_hash = JSON.parse(json) - expect(serializable_hash['data']['relationships'].has_key?('actors')).to be_falsey + expect(serializable_hash['data']['relationships'].has_key?('owner')).to be_falsey end end end diff --git a/spec/shared/contexts/movie_context.rb b/spec/shared/contexts/movie_context.rb index 6a5693e..bbd89a9 100644 --- a/spec/shared/contexts/movie_context.rb +++ b/spec/shared/contexts/movie_context.rb @@ -304,7 +304,7 @@ RSpec.shared_context 'movie class' do include FastJsonapi::ObjectSerializer set_type :movie attributes :name - has_many :actors, if: Proc.new { |record, params| params && params[:admin] == true } + belongs_to :owner, record_type: :user, if: Proc.new { |record, params| params && params[:admin] == true } end end