Make LikesController spec a bit more specific

This commit is contained in:
Raphael Sofaer 2011-06-15 15:19:36 -07:00
parent cba63030c9
commit dd67107ab1

View file

@ -73,7 +73,6 @@ describe LikesController do
end end
describe '#destroy' do describe '#destroy' do
context 'your like' do
before do before do
@message = bob.post(:status_message, :text => "hey", :to => @aspect1.id) @message = bob.post(:status_message, :text => "hey", :to => @aspect1.id)
@like = alice.build_like(:positive => true, :post => @message) @like = alice.build_like(:positive => true, :post => @message)
@ -84,6 +83,7 @@ describe LikesController do
expect { expect {
delete :destroy, :format => "js", :post_id => @like.post_id, :id => @like.id delete :destroy, :format => "js", :post_id => @like.post_id, :id => @like.id
}.should change(Like, :count).by(-1) }.should change(Like, :count).by(-1)
response.status.should == 200
end end
it 'does not let a user destroy other likes' do it 'does not let a user destroy other likes' do
@ -93,7 +93,8 @@ describe LikesController do
expect { expect {
delete :destroy, :format => "js", :post_id => like2.post_id, :id => like2.id delete :destroy, :format => "js", :post_id => like2.post_id, :id => like2.id
}.should_not change(Like, :count) }.should_not change(Like, :count)
end
response.status.should == 403
end end
end end
end end