From dcaa10147a96c796f61ec1ed86d6c2080ae98737 Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 29 Aug 2017 15:16:12 +0200 Subject: [PATCH] Relocate User model spec to Community model spec. --- spec/models/community_spec.rb | 17 +++++++++++++++++ spec/models/user_spec.rb | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/spec/models/community_spec.rb b/spec/models/community_spec.rb index 690854176..ce3d118cb 100644 --- a/spec/models/community_spec.rb +++ b/spec/models/community_spec.rb @@ -7,4 +7,21 @@ RSpec.describe Community, type: :model do expect(proposal.community).to be_valid 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 diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index f549c4c55..6db1a2a25 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -681,21 +681,4 @@ describe User do 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