la pirata quizas no esta en la barca closes #13
This commit is contained in:
parent
ce699c1344
commit
9018c30e90
2 changed files with 9 additions and 1 deletions
|
@ -117,7 +117,7 @@ class BarcasController < ApplicationController
|
||||||
def abandonar
|
def abandonar
|
||||||
find_barca
|
find_barca
|
||||||
|
|
||||||
if @barca.tripulaciones.find_by(pirata: current_pirata).destroy
|
if @barca.tripulaciones.find_by(pirata: current_pirata).try :destroy
|
||||||
notify(subject: :abandonar, urgency: :'very-low', ttl: 1.day)
|
notify(subject: :abandonar, urgency: :'very-low', ttl: 1.day)
|
||||||
render status: :no_content
|
render status: :no_content
|
||||||
else
|
else
|
||||||
|
|
|
@ -94,6 +94,14 @@ class BarcasControllerTest < ActionDispatch::IntegrationTest
|
||||||
assert_not barca.reload.piratas.include?(@pirata)
|
assert_not barca.reload.piratas.include?(@pirata)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test 'no se pueden abandonar si no estan abordadas' do
|
||||||
|
barca = create :barca
|
||||||
|
|
||||||
|
delete barca_abandonar_url(barca), as: :json, headers: @auth
|
||||||
|
|
||||||
|
assert_response :unprocessable_entity
|
||||||
|
end
|
||||||
|
|
||||||
test 'se pueden abordar' do
|
test 'se pueden abordar' do
|
||||||
barca = create :barca
|
barca = create :barca
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue