moved the test to the controller
This commit is contained in:
parent
06d7ddbe0d
commit
f134cfd43f
2 changed files with 10 additions and 9 deletions
|
|
@ -33,6 +33,15 @@ describe RequestsController do
|
||||||
:id => @friend_request.id.to_s
|
:id => @friend_request.id.to_s
|
||||||
response.should redirect_to(aspect_path(@user.aspects.first))
|
response.should redirect_to(aspect_path(@user.aspects.first))
|
||||||
end
|
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
|
end
|
||||||
describe 'when ignoring a contact request' do
|
describe 'when ignoring a contact request' do
|
||||||
it "succeeds" do
|
it "succeeds" do
|
||||||
|
|
@ -46,6 +55,7 @@ describe RequestsController do
|
||||||
:id => @friend_request.id.to_s
|
:id => @friend_request.id.to_s
|
||||||
}.should change(Request, :count).by(-1)
|
}.should change(Request, :count).by(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "marks the notification as read" do
|
it "marks the notification as read" do
|
||||||
notification = Notification.where(:user_id => @user.id, :target_id=> @friend_request.id).first
|
notification = Notification.where(:user_id => @user.id, :target_id=> @friend_request.id).first
|
||||||
notification.reload.unread.should == true
|
notification.reload.unread.should == true
|
||||||
|
|
|
||||||
|
|
@ -106,15 +106,6 @@ describe Diaspora::UserModules::Connecting do
|
||||||
}.should change(Request, :count ).by(-1)
|
}.should change(Request, :count ).by(-1)
|
||||||
end
|
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
|
it 'should be able to ignore a pending contact request' do
|
||||||
proc { user.ignore_contact_request(@received_request.id)
|
proc { user.ignore_contact_request(@received_request.id)
|
||||||
}.should change(Request, :count ).by(-1)
|
}.should change(Request, :count ).by(-1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue