diff --git a/features/notifications.feature b/features/notifications.feature index e4878d479..5f6b7d254 100644 --- a/features/notifications.feature +++ b/features/notifications.feature @@ -8,11 +8,11 @@ Feature: Notifications Given a user with email "bob@bob.bob" And a user with email "alice@alice.alice" When I sign in as "bob@bob.bob" + + Scenario: someone shares with me And I am on "alice@alice.alice"'s page And I add the person to my 1st aspect And I go to the destroy user session page - - Scenario: someone shares with me When I sign in as "alice@alice.alice" And I follow "notifications" in the header And I wait for the ajax to finish @@ -20,3 +20,21 @@ Feature: Notifications Then I should see "started sharing with you" When I follow "View all" Then I should see "started sharing with you" + + Scenario: someone re-shares my post + And a user with email "bob@bob.bob" is connected with "alice@alice.alice" + And "alice@alice.alice" has a public post with text "reshare this!" + And I am on "alice@alice.alice"'s page + And I preemptively confirm the alert + And I follow "Reshare" + And I wait for the ajax to finish + + And I go to the destroy user session page + When I sign in as "alice@alice.alice" + + And I follow "notifications" in the header + And I wait for the ajax to finish + Then the notification dropdown should be visible + Then I should see "reshared your post" + When I follow "View all" + Then I should see "reshared your post" diff --git a/features/repost.feature b/features/reshare.feature similarity index 100% rename from features/repost.feature rename to features/reshare.feature diff --git a/spec/models/reshare_spec.rb b/spec/models/reshare_spec.rb index 91319f460..d64095a94 100644 --- a/spec/models/reshare_spec.rb +++ b/spec/models/reshare_spec.rb @@ -51,6 +51,19 @@ describe Reshare do end end + describe '#notification_type' do + before do + @reshare = Factory.create(:reshare, :author => alice.person) + end + it 'does not return anything for the author' do + @reshare.notification_type(bob, @reshare.author).should be_nil + end + + it 'returns private mesage for an actual receiver' do + @reshare.notification_type(alice, @reshare.author).should == Notifications::PrivateMessage + end + end + describe "XML" do before do @reshare = Factory(:reshare)