fixed notification specs; removed a cuke around reshares already tested in jasmine

This commit is contained in:
danielgrippi 2011-12-31 19:13:47 -05:00 committed by Dennis Collinson
parent f804db36b8
commit 71bae10317
3 changed files with 17 additions and 43 deletions

View file

@ -65,7 +65,7 @@ class Comment < ActiveRecord::Base
def notification_type(user, person)
if self.post.author == user.person
return Notifications::CommentOnPost
elsif self.post.comments.where(:author_id => user.person.id) != [] && self.author_id != user.person.id
return Notifications::AlsoCommented
else

View file

@ -25,24 +25,6 @@ Feature: public repost
Then I should see a ".reshare"
And I should see "Bob"
# (NOTE) this should be a jasmine spec
# assert that it is added to app.stream's collection
Scenario: When I reshare, it shows up in my stream
Given "bob@bob.bob" has a public post with text "reshare this!"
And I sign in as "alice@alice.alice"
And I preemptively confirm the alert
And I follow "Reshare"
And I wait for the ajax to finish
# NOTE(why do we need this to make this work?)
And I wait for 2 seconds
And I go to the home page
And I wait for the ajax to finish
Then I should see a ".reshare"
And I should see "reshare this!"
And I should see "Bob"
# (NOTE) this should be a jasmine spec
Scenario: I can see the number of reshares
Given "bob@bob.bob" has a public post with text "reshare this!"
@ -51,15 +33,7 @@ Feature: public repost
And I preemptively confirm the alert
And I follow "Reshare"
# NOTE(why do we need this to make this work?)
And I wait for 2 seconds
When I go to the home page
Then I should see a ".reshare"
And I should see "reshare this!"
And I should see "Bob"
# NOTE(why do we need this to make this work?)
And I wait for 2 seconds
When I go to the home page
And I wait for the ajax to finish
Then I should see "1 reshare"

View file

@ -113,26 +113,26 @@ describe("app.views.Feedback", function(){
expect($(this.view.el).html()).not.toContain('reshare_action')
})
})
})
context("reshares", function(){
beforeEach(function(){
this.post.attributes.public = true
this.post.attributes.root = {author : {name : "susan"}};
this.view.render();
})
describe("resharePost", function(){
beforeEach(function(){
this.post.attributes.public = true
this.post.attributes.root = {author : {name : "susan"}};
this.view.render();
})
it("displays a confirmation dialog", function(){
spyOn(window, "confirm")
it("displays a confirmation dialog", function(){
spyOn(window, "confirm")
this.view.$(".reshare_action").first().click();
expect(window.confirm).toHaveBeenCalled();
})
this.view.$(".reshare_action").first().click();
expect(window.confirm).toHaveBeenCalled();
})
it("creates a reshare if the confirmation dialog is accepted", function(){
spyOn(window, "confirm").andReturn(true);
it("creates a reshare if the confirmation dialog is accepted", function(){
spyOn(window, "confirm").andReturn(true);
expect(this.view.resharePost().constructor).toBe(app.models.Reshare);
})
expect(this.view.resharePost().constructor).toBe(app.models.Reshare);
})
})
})