diaspora/spec/javascripts/app/models/reshare_spec.js
2012-01-17 17:22:56 -08:00

28 lines
861 B
JavaScript

describe("app.models.Reshare", function(){
beforeEach(function(){
this.reshare = new app.models.Reshare({root: {a:"namaste", be : "aloha", see : "community"}})
});
describe("rootPost", function(){
it("should be the root attrs", function(){
expect(this.reshare.rootPost().get("be")).toBe("aloha")
});
it("should return a post", function(){
expect(this.reshare.rootPost() instanceof app.models.Post).toBeTruthy()
});
it("does not create a new object every time", function(){
expect(this.reshare.rootPost()).toBe(this.reshare.rootPost())
});
});
describe(".reshare", function(){
it("reshares the root post", function(){
spyOn(this.reshare.rootPost(), "reshare")
this.reshare.reshare()
expect(this.reshare.rootPost().reshare).toHaveBeenCalled()
})
})
});