Change logic test for GeojsonServiceSpec

This commit is contained in:
Xavier J 2015-11-30 17:12:32 +01:00
parent 141e23a381
commit 91cf5020fc

View file

@ -2,22 +2,13 @@ require 'spec_helper'
describe GeojsonService do
describe '.toGeoJsonPolygon' do
let(:to_polygon_return) {
{
geo: {
type: "Polygon",
coordinates: [coordinates]
}
}.to_json
}
subject { described_class.to_json_polygon coordinates }
subject { JSON.parse(described_class.to_json_polygon coordinates) }
describe 'coordinates are empty' do
let(:coordinates) { '' }
it { expect(subject).to eq(to_polygon_return) }
it { expect(subject['geo']['type']).to eq('Polygon') }
it { expect(subject['geo']['coordinates']).to eq([coordinates]) }
end
describe 'coordinates are informed' do
@ -36,7 +27,8 @@ describe GeojsonService do
]
}
it { expect(subject).to eq(to_polygon_return) }
it { expect(subject['geo']['type']).to eq('Polygon') }
it { expect(subject['geo']['coordinates']).to eq([coordinates]) }
end
end
end