Skip to content

Commit

Permalink
Exportar coordenadas por separado (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciopasquier committed Aug 29, 2016
1 parent aac563d commit a5a3a7b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/serializers/ubicacion_serializer.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class UbicacionSerializer < ActiveModel::Serializer
attributes :descripcion, :recorrido, :mosaico, :aerofoto, :coordenadas
attributes :descripcion, :recorrido, :mosaico, :aerofoto, :latitud, :longitud
end
20 changes: 20 additions & 0 deletions test/models/serializers/ubicacion_serializer_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require './test/test_helper'

class UbicacionSerializerTest < ActiveSupport::TestCase
subject { UbicacionSerializer.new(ubicacion) }
let(:ubicacion) { create(:ubicacion, :con_perfil) }

it 'no serializa coordenadas juntas' do
subject.serializable_hash.keys.include?(:coordenadas).wont_equal true
end

it 'serializa latitud y longitud por separado' do
hash = subject.serializable_hash

hash.keys.include?(:latitud).must_equal true
hash.keys.include?(:longitud).must_equal true

hash[:latitud].must_equal ubicacion.latitud
hash[:longitud].must_equal ubicacion.longitud
end
end

0 comments on commit a5a3a7b

Please sign in to comment.