Skip to content

Commit

Permalink
Test ApiGeo RPGAdapter
Browse files Browse the repository at this point in the history
  • Loading branch information
tchak committed Oct 23, 2018
1 parent fd490ef commit 4abcffe
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 0 deletions.
51 changes: 51 additions & 0 deletions spec/fixtures/cassettes/api_geo_search_rpg.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions spec/lib/api_geo/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,55 @@

it { is_expected.to eq pays }
end

describe '.search_rpg', vcr: { cassette_name: 'api_geo_search_rpg' } do
let(:coordinates) do
[
[
2.3945903778076176,
46.53312237252731
],
[
2.394933700561524,
46.532590956418076
],
[
2.3948478698730473,
46.53170525134736
],
[
2.393732070922852,
46.530760483351195
],
[
2.3909854888916016,
46.5309376286023
],
[
2.391414642333985,
46.531232869403546
],
[
2.3913288116455083,
46.53253190986272
],
[
2.39278793334961,
46.53329951007484
],
[
2.3945903778076176,
46.53312237252731
]
]
end

let(:geo_json) {
GeojsonService.to_json_polygon_for_rpg(coordinates)
}

subject { described_class.search_rpg(geo_json) }

it { expect(subject[:features].size).to eq 3 }
end
end
61 changes: 61 additions & 0 deletions spec/lib/api_geo/rpg_adapter_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
require 'spec_helper'

describe ApiGeo::RPGAdapter do
subject { described_class.new(coordinates).results }

let(:coordinates) do
[
[
2.3945903778076176,
46.53312237252731
],
[
2.394933700561524,
46.532590956418076
],
[
2.3948478698730473,
46.53170525134736
],
[
2.393732070922852,
46.530760483351195
],
[
2.3909854888916016,
46.5309376286023
],
[
2.391414642333985,
46.531232869403546
],
[
2.3913288116455083,
46.53253190986272
],
[
2.39278793334961,
46.53329951007484
],
[
2.3945903778076176,
46.53312237252731
]
]
end

context 'coordinates are filled', vcr: { cassette_name: 'api_geo_search_rpg' } do
describe 'Attribut filter' do
it { expect(subject.size).to eq(3) }
it do
expect(subject.first.keys).to eq([
:culture,
:code_culture,
:surface,
:bio,
:geometry
])
end
end
end
end

0 comments on commit 4abcffe

Please sign in to comment.