Skip to content
Permalink
Browse files

Merge pull request #2425 from ekylibre/debug-landparcels-index

[Exception] land_parcels#index (ActionView::Template::Error) undefine…
  • Loading branch information...
Aquaj committed Mar 14, 2019
2 parents ae2c3d2 + ae89782 commit aae6b7560d5a9d51a04792eb1429862d0c3ebd9e
Showing with 28 additions and 2 deletions.
  1. +1 −1 app/helpers/backend/land_parcels_helper.rb
  2. +27 −1 test/helpers/backend/land_parcels_helper_test.rb
@@ -8,7 +8,7 @@ def land_parcels_map(options = {})
v.control :scale
v.control :fullscreen
v.control :layer_selector
if LandParcel.last.shape_centroid.present?
if LandParcel.last && LandParcel.last.shape_centroid.present?
v.center LandParcel.last.shape_centroid
end
end
@@ -2,6 +2,32 @@

module Backend
class LandParcelsHelperTest < ActionView::TestCase
# Add tests here...
class MockLandParcelHelper
include Backend::LandParcelsHelper
def backend_visualizations_land_parcels_visualizations_path
''
end

def visualization(_param1, _param2)
v = Object.new
def v.control(_arg1) end

def v.center(_arg2) end

yield v
end
end

setup do
@helper = MockLandParcelHelper.new
end

test 'LandParcelsHelper::land_parcels_map does not fails when no LandParcel present' do
LandParcel.delete_all

assert_nothing_raised do
@helper.land_parcels_map
end
end
end
end

0 comments on commit aae6b75

Please sign in to comment.
You can’t perform that action at this time.