Relocate User model spec to Community model spec.
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user