Refactor and tests.

This commit is contained in:
taitus
2017-08-10 15:02:02 +02:00
parent 555c47e012
commit 4539c5fa00
36 changed files with 1023 additions and 110 deletions

View File

@@ -680,4 +680,22 @@ describe User do
end
end
describe "#community_participants" do
it "should return participants without duplicates" do
proposal = create(:proposal)
community = proposal.community
user1 = create(:user)
user2 = create(:user)
topic1 = create(:topic, community: community, author: user1)
create(:comment, commentable: topic1, author: user1)
create(:comment, commentable: topic1, author: user2)
topic2 = create(:topic, community: community, author: user2)
expect(User.community_participants(community)).to eq [user1, user2]
end
end
end