spec to generate some notification fixtures and jasmine specs to test them. Notably making sure that start sharing items have an aspects popup menu.

This commit is contained in:
Steven Fuchs 2012-01-24 23:04:35 -05:00
parent d8f2e73ea2
commit 5f705775cd
2 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,37 @@
# Copyright (c) 2010-2011, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe NotificationsController do
describe '#notifications' do
before do
sign_in :user, alice
end
context 'jasmine fixtures' do
before do
end
it "generates a jasmine fixture of two notifications", :fixture => true do
post = Factory(:status_message)
Factory(:notification, :recipient => alice, :target => post)
Factory(:notification, :recipient => alice, :target => post)
get :index
save_fixture( html_for("body"), "notifications_index")
end
it "generates a jasmine fixture of with a start sharing notifcation from a contact", :fixture => true do
post = Factory(:status_message)
eve.share_with(alice.person, eve.aspects.first)
Factory(:notification, :recipient => alice, :target => post)
Factory(:notification, :recipient => alice, :target => post)
get :index
save_fixture(html_for("body"), "notifications_index_with_sharing")
end
end
end
end

View file

@ -0,0 +1,30 @@
describe("app.views.Notification", function(){
var pageText = null;
describe("render regular notifications", function(){
beforeEach(function(){
pageText = spec.readFixture("notifications_index");
});
it("has two notifications", function(){
expect( $( pageText ).find('.stream_element').length).toBe(2)
});
it("has no aspects menu", function(){
expect( $( pageText ).find('.dropdown_list').length).toBe(0)
});
});
describe("render a start sharing notification", function(){
beforeEach(function(){
pageText = spec.readFixture("notifications_index_with_sharing");
});
it("has three notifications", function(){
expect( $( pageText ).find('.stream_element').length).toBe(3)
});
it("has shows an aspect menu for the start sharing item", function(){
expect( $( pageText ).find('.aspect_membership').length).toBe(1)
});
});
})