diff --git a/app/views/barcas/_barca.json.jbuilder b/app/views/barcas/_barca.json.jbuilder index c596bd3..6d5f2f1 100644 --- a/app/views/barcas/_barca.json.jbuilder +++ b/app/views/barcas/_barca.json.jbuilder @@ -4,3 +4,4 @@ json.call(barca, :id, :created_at, :nombre, :descripcion) json.abordada @current_pirata.barcas.pluck(:id).include?(barca.id) json.eliminable barca.consensos.count.zero? +json.tripulacion barca.piratas.count diff --git a/test/controllers/barcas_controller_test.rb b/test/controllers/barcas_controller_test.rb index a4524e4..9f0b03f 100644 --- a/test/controllers/barcas_controller_test.rb +++ b/test/controllers/barcas_controller_test.rb @@ -111,6 +111,8 @@ class BarcasControllerTest < ActionDispatch::IntegrationTest body = JSON.parse @response.body assert body['barcas'].first['abordada'] + assert_equal 1, body['barcas'].first['tripulacion'] assert_not body['barcas'].last['abordada'] + assert_equal 0, body['barcas'].last['tripulacion'] end end