Browse Source

Lint fixes for previous feature merge

tags/0.3.6^2
Bèr Kessels 1 month ago
parent
commit
a0cbdaa77d
4 changed files with 28 additions and 11 deletions
  1. 17
    4
      app/models/city.rb
  2. 1
    1
      lib/app.rb
  3. 4
    1
      lib/errors.rb
  4. 6
    5
      test/projections/city_query_test.rb

+ 17
- 4
app/models/city.rb View File

@@ -41,6 +41,7 @@ module Hours

def shape
return if bbox.empty?

RGeo::GeoJSON::EntityFactory.new.feature(factory.polygon(bbox_as_ring))
end

@@ -52,13 +53,25 @@ module Hours
# [1] 51.7905891,
# [2] 5.9083469,
# [3] 51.8946209
top_left = factory.point(bbox[0], bbox[1])
top_right = factory.point(bbox[2], bbox[1])
bottom_right = factory.point(bbox[2], bbox[3])
bottom_left = factory.point(bbox[0], bbox[3])
factory.linear_ring([top_left, top_right, bottom_right, bottom_left])
end

def top_left
factory.point(bbox[0], bbox[1])
end

def top_right
factory.point(bbox[2], bbox[1])
end

def bottom_right
factory.point(bbox[2], bbox[3])
end

def bottom_left
factory.point(bbox[0], bbox[3])
end

def factory
@factory ||= RGeo::Cartesian.simple_factory(srid: 4326)
end

+ 1
- 1
lib/app.rb View File

@@ -90,7 +90,7 @@ module Hours
end

def not_found
body "Not Found: 404"
body 'Not Found: 404'
status 404
end


+ 4
- 1
lib/errors.rb View File

@@ -1,4 +1,7 @@
## Raised when we recieved an empty city or a 404 for a city
# frozen_string_literal: true

##
# Raised when we recieved an empty city or a 404 for a city
module Hours
class CityNotFound < ::StandardError; end
end

+ 6
- 5
test/projections/city_query_test.rb View File

@@ -25,22 +25,23 @@ describe Hours::Projections::CityQuery do
@error_response = error_response
end

def get(*args)
def get(*)
@search_response
end
def post(*args)

def post(*)
raise(
Faraday::BadRequestError,
{ status: 400, headers: [], body: @error_response }
status: 400, headers: [], body: @error_response
)
end
end

class ClientRaisesNotFound
def get(*args)
def get(*)
raise(
Faraday::ResourceNotFound,
{ status: 404, headers: [], body: "" }
status: 404, headers: [], body: ''
)
end
end

Loading…
Cancel
Save