diaspora/spec/javascripts/app/models/photo_spec.js
danielgrippi a1d4ca9bec Refactor composer and framer to user same layout
composer touchup; added controls to the bottom; centered input area; removed forms.Base view

Fix tests
2012-04-10 11:38:35 -07:00

26 lines
752 B
JavaScript

describe("app.models.Photo", function() {
beforeEach(function(){
this.photo = new app.models.Photo();
});
describe("url", function(){
it("should be /photos when it doesn't have an id", function(){
expect(new app.models.Photo().url()).toBe("/photos");
});
it("should be /photos/id when it has an id", function(){
expect(new app.models.Photo({id: 5}).url()).toBe("/photos/5");
});
});
describe("createdAt", function() {
it("returns the photo's created_at as an integer", function() {
var date = new Date;
this.photo.set({ created_at: +date * 1000 });
expect(typeof this.photo.createdAt()).toEqual("number");
expect(this.photo.createdAt()).toEqual(+date);
});
});
});