Move multiple participations test to rspec

This commit is contained in:
Steffen van Bergerem 2016-03-05 09:36:04 +01:00
parent 6ef4345dae
commit 6e6a5c1e29
2 changed files with 25 additions and 32 deletions

View file

@ -41,35 +41,3 @@ Feature: The activity stream
And I unlike the post "Look at this dog" in the stream
And I go to the activity stream page
Then I should not see "Look at this dog"
Scenario: multiple participations
When I sign in as "bob@bob.bob"
And I am on "alice@alice.alice"'s page
Then I should see "Look at this dog"
When I like the post "Look at this dog" in the stream
And I go to the activity stream page
Then I should see "Look at this dog"
When I am on "alice@alice.alice"'s page
Then I should see "Look at this dog"
When I focus the comment field
And I fill in the following:
| text | is that a poodle? |
And I press "Comment"
And I go to the activity stream page
Then I should see "Look at this dog"
When I am on "alice@alice.alice"'s page
And I unlike the post "Look at this dog" in the stream
And I go to the activity stream page
Then I should see "Look at this dog"
When I am on "alice@alice.alice"'s page
And I click to delete the first comment
And I confirm the alert
And I go to the activity stream page
Then I should not see "Look at this dog"

View file

@ -65,4 +65,29 @@ describe EvilQuery::Participation do
expect(posts.map(&:id)).to eq([@status_messageE.id, @status_messageA.id, @status_messageB.id])
end
end
describe "multiple participations" do
before do
@status_message = FactoryGirl.create(:status_message, author: bob.person)
@like = alice.like!(@status_message)
@comment = alice.comment!(@status_message, "party")
end
let(:posts) { EvilQuery::Participation.new(alice).posts }
it "includes Posts with multiple participations" do
expect(posts.map(&:id)).to eq([@status_message.id])
end
it "includes Posts with multiple participation after removing one participation" do
@like.destroy
expect(posts.map(&:id)).to eq([@status_message.id])
end
it "doesn't includes Posts after removing all of their participations" do
@like.destroy
@comment.destroy
expect(posts.map(&:id)).not_to include(@status_message.id)
end
end
end