notification for reshares WIP

This commit is contained in:
Ilyaaaaaaaaaaaaa Zhitomirskiy 2011-08-24 19:40:08 -07:00
parent 31733e1f9f
commit e45278a043
3 changed files with 33 additions and 2 deletions

View file

@ -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"

View file

@ -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)