moved the test to the controller

This commit is contained in:
zhitomirskiyi 2011-01-04 15:44:39 -08:00
parent 06d7ddbe0d
commit f134cfd43f
2 changed files with 10 additions and 9 deletions

View file

@ -33,6 +33,15 @@ describe RequestsController do
:id => @friend_request.id.to_s
response.should redirect_to(aspect_path(@user.aspects.first))
end
it "marks the notification as read" do
notification = Notification.where(:user_id => @user.id, :target_id=> @friend_request.id).first
notification.reload.unread.should == true
xhr :delete, :destroy,
:accept => "true",
:aspect_id => @user.aspects.first.id.to_s,
:id => @friend_request.id.to_s
notification.reload.unread.should == false
end
end
describe 'when ignoring a contact request' do
it "succeeds" do
@ -46,6 +55,7 @@ describe RequestsController do
:id => @friend_request.id.to_s
}.should change(Request, :count).by(-1)
end
it "marks the notification as read" do
notification = Notification.where(:user_id => @user.id, :target_id=> @friend_request.id).first
notification.reload.unread.should == true

View file

@ -106,15 +106,6 @@ describe Diaspora::UserModules::Connecting do
}.should change(Request, :count ).by(-1)
end
it "should mark the corresponding notification as 'read'" do
notification = Notification.create(:target_id => @received_request.id,
:kind => 'new_request',
:unread => true)
Notification.first(:target_id=>@received_request.id).unread.should be_true
user.accept_contact_request(@received_request, aspect)
Notification.first(:target_id=>@received_request.id).unread.should be_false
end
it 'should be able to ignore a pending contact request' do
proc { user.ignore_contact_request(@received_request.id)
}.should change(Request, :count ).by(-1)