Skip to content

Commit

Permalink
test: update proposal serializer test
Browse files Browse the repository at this point in the history
  • Loading branch information
Stef-Rousset committed Oct 10, 2024
1 parent ec114d6 commit dd46cdf
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/services/decidim/proposals/proposal_serializer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,27 @@ module Proposals
expect(serialized[:author][:phone_number]).not_to be_empty
end

context "and proposal has user_group as author" do
let!(:proposal) { create(:proposal, :user_group_author, :accepted) }

before do
proposal.coauthorships.clear
user = create(:user, organization: proposal.component.participatory_space.organization)
user_group = create(:user_group, :verified, organization: user.organization, users: [user])
proposal.coauthorships.create(author: user_group)
end

it "serializes author" do
expect(serialized).to include(:author)
end

it "data in author are not empty" do
expect(serialized[:author][:name]).not_to be_empty
expect(serialized[:author][:nickname]).not_to be_empty
expect(serialized[:author][:email]).not_to be_empty
end
end

context "when proposal was created by admin from backoffice" do
let!(:admin) { create(:user, :admin) }

Expand Down

0 comments on commit dd46cdf

Please sign in to comment.