Files
grecia/spec/models/community_spec.rb
Bertocq ed16a78f42 Enables RSpec/ExampleWording and fixes all issues
Both avoiding 'should' and repiting 'it' on the tests description
improves reading them and also makes all descriptions consistent.

Read about cop at http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/ExampleWording
2018-01-07 01:03:45 +01:00

30 lines
849 B
Ruby

require 'rails_helper'
RSpec.describe Community, type: :model do
it "is valid when create proposal" do
proposal = create(:proposal)
expect(proposal.community).to be_valid
end
describe "#participants" do
it "returns 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 include(user1)
expect(community.participants).to include(user2)
expect(community.participants).to include(proposal.author)
end
end
end