HULK SMASH PENDING SPEC
This commit is contained in:
parent
574deada03
commit
5e56b8a0ee
2 changed files with 7 additions and 8 deletions
|
|
@ -32,7 +32,7 @@ class LikesController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
if @like = Like.where(:post_id => params[:post_id], :author_id => current_user.person.id).first
|
||||
if @like = Like.where(:id => params[:id], :author_id => current_user.person.id).first
|
||||
current_user.retract(@like)
|
||||
else
|
||||
respond_to do |format|
|
||||
|
|
|
|||
|
|
@ -81,19 +81,18 @@ describe LikesController do
|
|||
end
|
||||
|
||||
it 'lets a user destroy their like' do
|
||||
alice.should_receive(:retract).with(@like)
|
||||
delete :destroy, :format => "js", :post_id => @like.post_id, :id => @like.id
|
||||
response.should be_success
|
||||
expect {
|
||||
delete :destroy, :format => "js", :post_id => @like.post_id, :id => @like.id
|
||||
}.should change(Like, :count).by(-1)
|
||||
end
|
||||
|
||||
it 'does not let a user destroy other likes' do
|
||||
pending "not really relevant to how we're using the destory method. not totally RESTful right now"
|
||||
like2 = eve.build_like(true, :on => @message)
|
||||
like2.save
|
||||
|
||||
alice.should_not_receive(:retract)
|
||||
delete :destroy, :format => "js", :post_id => like2.post_id, :id => like2.id
|
||||
response.status.should == 403
|
||||
expect {
|
||||
delete :destroy, :format => "js", :post_id => like2.post_id, :id => like2.id
|
||||
}.should_not change(Like, :count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue