Relocate User model spec to Community model spec.

This commit is contained in:
taitus
2017-08-29 15:16:12 +02:00
parent 90518d4f99
commit dcaa10147a
2 changed files with 17 additions and 17 deletions

View File

@@ -7,4 +7,21 @@ RSpec.describe Community, type: :model do
expect(proposal.community).to be_valid expect(proposal.community).to be_valid
end end
describe "#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(community.participants).to eq [user1, user2]
end
end
end end

View File

@@ -681,21 +681,4 @@ 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 end