mostrar la tripulacion

This commit is contained in:
fauno 2019-09-04 11:08:43 -03:00
parent 0d4b01b2b0
commit 3924237ab0
No known key found for this signature in database
GPG key ID: 456032D717A4CD9C
2 changed files with 3 additions and 0 deletions

View file

@ -4,3 +4,4 @@ json.call(barca, :id, :created_at, :nombre, :descripcion)
json.abordada @current_pirata.barcas.pluck(:id).include?(barca.id) json.abordada @current_pirata.barcas.pluck(:id).include?(barca.id)
json.eliminable barca.consensos.count.zero? json.eliminable barca.consensos.count.zero?
json.tripulacion barca.piratas.count

View file

@ -111,6 +111,8 @@ class BarcasControllerTest < ActionDispatch::IntegrationTest
body = JSON.parse @response.body body = JSON.parse @response.body
assert body['barcas'].first['abordada'] assert body['barcas'].first['abordada']
assert_equal 1, body['barcas'].first['tripulacion']
assert_not body['barcas'].last['abordada'] assert_not body['barcas'].last['abordada']
assert_equal 0, body['barcas'].last['tripulacion']
end end
end end