Skip to content

Commit

Permalink
Add tests for serializing relationships that are not allowed to be pu…
Browse files Browse the repository at this point in the history
…shed
  • Loading branch information
benedikt committed Nov 30, 2023
1 parent a9e2196 commit 0187cdd
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/userlist/push/serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,20 @@
)
end
end

context 'when serializing the relationship is not allowed' do
before do
allow_any_instance_of(Userlist::Push::Relationship).to receive(:push?).and_return(false)
end

it 'should return the correct payload' do
expect(payload).to eq(
identifier: 'user-identifier',
email: 'foo@example.com',
signed_up_at: nil
)
end
end
end

context 'when serializing the company' do
Expand Down Expand Up @@ -145,6 +159,20 @@
expect(payload).to_not be
end
end

context 'when serializing the relationship is not allowed' do
before do
allow_any_instance_of(Userlist::Push::Relationship).to receive(:push?).and_return(false)
end

it 'should return the correct payload' do
expect(payload).to eq(
identifier: 'company-identifier',
name: 'Example, Inc.',
signed_up_at: nil
)
end
end
end

context 'when serializing the relationship' do
Expand Down

0 comments on commit 0187cdd

Please sign in to comment.