commit
6c9f191696
3 changed files with 24 additions and 1 deletions
|
|
@ -78,6 +78,7 @@ This is disabled by default since it requires the installation of additional pac
|
||||||
* Replace `opengraph_parser` with `open_graph_reader` [#5462](https://github.com/diaspora/diaspora/pull/5462)
|
* Replace `opengraph_parser` with `open_graph_reader` [#5462](https://github.com/diaspora/diaspora/pull/5462)
|
||||||
* Make sure conversations without any visibilities left are deleted [#5478](https://github.com/diaspora/diaspora/pull/5478)
|
* Make sure conversations without any visibilities left are deleted [#5478](https://github.com/diaspora/diaspora/pull/5478)
|
||||||
* Change tooltip for delete button in conversations view [#5477](https://github.com/diaspora/diaspora/pull/5477)
|
* Change tooltip for delete button in conversations view [#5477](https://github.com/diaspora/diaspora/pull/5477)
|
||||||
|
* Replace a modifier-rescue with a specific rescue [#5491](https://github.com/diaspora/diaspora/pull/5491)
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* orca cannot see 'Add Contact' button [#5158](https://github.com/diaspora/diaspora/pull/5158)
|
* orca cannot see 'Add Contact' button [#5158](https://github.com/diaspora/diaspora/pull/5158)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,13 @@ class LikesController < ApplicationController
|
||||||
:json
|
:json
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@like = current_user.like!(target) if target rescue ActiveRecord::RecordInvalid
|
begin
|
||||||
|
@like = if target
|
||||||
|
current_user.like!(target)
|
||||||
|
end
|
||||||
|
rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid => e
|
||||||
|
# do nothing
|
||||||
|
end
|
||||||
|
|
||||||
if @like
|
if @like
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,22 @@ describe LikesController, :type => :controller do
|
||||||
expect(response.code).to eq('422')
|
expect(response.code).to eq('422')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when an the exception is raised" do
|
||||||
|
it "should be catched when it means that the target is not found" do
|
||||||
|
allow(@target).to receive(:id).and_return(-1)
|
||||||
|
post :create, like_hash.merge(:format => :json)
|
||||||
|
expect(response.code).to eq('422')
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should not be catched when it is unexpected" do
|
||||||
|
@target = alice.post :status_message, :text => "AWESOME", :to => @alices_aspect.id
|
||||||
|
@target = alice.comment!(@target, "hey") if class_const == Comment
|
||||||
|
allow(alice).to receive(:like!).and_raise("something")
|
||||||
|
allow(@controller).to receive(:current_user).and_return(alice)
|
||||||
|
expect { post :create, like_hash.merge(:format => :json) }.to raise_error("something")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#index' do
|
describe '#index' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue