Skip to content

Commit 2971afe

Browse files
committed
fixes #6
1 parent fe42e1b commit 2971afe

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

lib/redmine_gtt_print/mapfish.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ def layouts(print_config)
2020
end
2121
end
2222

23+
# returns capabilities document for the given print config,
24+
# nil if no print_config is given or no capabilities were found for it.
2325
def get_capabilities(print_config)
26+
return unless print_config
2427
str = URI.escape(print_config)
2528
r = HTTParty.get "#{@host}/print/#{str}/capabilities.json"
2629
if r.success?
27-
JSON.parse r.body
28-
else
29-
:not_found
30+
return JSON.parse r.body
3031
end
3132
end
3233

test/integration/mapfish_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class MapfishTest < ActionDispatch::IntegrationTest
2323
assert configs.include?("DEMO_gtt")
2424
end
2525

26+
test "should handle nil print config" do
27+
assert_nil @mapfish.layouts nil
28+
end
29+
2630
test "should have layouts for print config" do
2731
assert layouts = @mapfish.layouts("DEMO_gtt")
2832
assert_equal Array, layouts.class

0 commit comments

Comments
 (0)