From 6e6a5c1e293204a0bf1902e5954b6d2b32f3b6d3 Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Sat, 5 Mar 2016 09:36:04 +0100 Subject: [PATCH] Move multiple participations test to rspec --- features/desktop/activity_stream.feature | 32 ------------------------ spec/lib/evil_query_spec.rb | 25 ++++++++++++++++++ 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/features/desktop/activity_stream.feature b/features/desktop/activity_stream.feature index 783a5e12c..1f671572e 100644 --- a/features/desktop/activity_stream.feature +++ b/features/desktop/activity_stream.feature @@ -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" diff --git a/spec/lib/evil_query_spec.rb b/spec/lib/evil_query_spec.rb index 0e98c5c78..f0cdb7f67 100644 --- a/spec/lib/evil_query_spec.rb +++ b/spec/lib/evil_query_spec.rb @@ -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