Try to improve the notifications controller spec

This commit is contained in:
Steffen van Bergerem 2014-12-01 02:27:19 +01:00
parent 4f8cf0fe07
commit 7b17b78de7

View file

@ -131,25 +131,23 @@ describe NotificationsController, :type => :controller do
expect(Notification.where(:unread => true).count).to eq(1) expect(Notification.where(:unread => true).count).to eq(1)
end end
it "should redirect back in the html version if it has > 0 notifications" do it "should redirect back in the html version if it has > 0 notifications" do
FactoryGirl.create(:notification, :recipient => alice) FactoryGirl.create(:notification, :recipient => alice, :type => "Notifications::StartedSharing")
eve.share_with(alice.person, eve.aspects.first) get :read_all, :format => :html, "type" => "liked"
get :read_all, :format => :html, "type" => "started_sharing"
expect(response).to redirect_to(notifications_path) expect(response).to redirect_to(notifications_path)
end end
it "should redirect back in the mobile version if it has > 0 notifications" do it "should redirect back in the mobile version if it has > 0 notifications" do
FactoryGirl.create(:notification, :recipient => alice) FactoryGirl.create(:notification, :recipient => alice, :type => "Notifications::StartedSharing")
eve.share_with(alice.person, eve.aspects.first) get :read_all, :format => :mobile, "type" => "liked"
get :read_all, :format => :mobile, "type" => "started_sharing"
expect(response).to redirect_to(notifications_path) expect(response).to redirect_to(notifications_path)
end end
it "should redirect to stream in the html version if it has 0 notifications" do it "should redirect to stream in the html version if it has 0 notifications" do
FactoryGirl.create(:notification, :recipient => alice) FactoryGirl.create(:notification, :recipient => alice, :type => "Notifications::StartedSharing")
get :read_all, :format => :html get :read_all, :format => :html, "type" => "started_sharing"
expect(response).to redirect_to(stream_path) expect(response).to redirect_to(stream_path)
end end
it "should redirect back in the mobile version if it has 0 notifications" do it "should redirect back in the mobile version if it has 0 notifications" do
FactoryGirl.create(:notification, :recipient => alice) FactoryGirl.create(:notification, :recipient => alice, :type => "Notifications::StartedSharing")
get :read_all, :format => :mobile get :read_all, :format => :mobile, "type" => "started_sharing"
expect(response).to redirect_to(stream_path) expect(response).to redirect_to(stream_path)
end end
it "should return a dummy value in the json version" do it "should return a dummy value in the json version" do