Skip to content

Commit 06cdc4e

Browse files
committed
fix specs
1 parent 9925332 commit 06cdc4e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/liquid-rails/filters/google_static_map_url_filter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def google_static_map_url(size, options={})
1818
else
1919
''
2020
end
21+
options = options.merge('size' => size)
2122
querystring = [options.to_query, markers].delete_if { |value| value.blank? }.join('&')
2223

2324
"https://maps.googleapis.com/maps/api/staticmap?#{querystring}"

spec/lib/liquid-rails/filters/google_static_map_url_filter_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ module Liquid
44
module Rails
55
describe GoogleStaticMapUrlFilter, type: :filter do
66
it 'returns url with center' do
7-
expect_template_result("{{ '600x300' | google_static_map_url: center: '40.714728,-73.998672' }}", 'https://maps.googleapis.com/maps/api/staticmap?center=40.714728%2C-73.998672')
7+
expect_template_result("{{ '600x300' | google_static_map_url: center: '40.714728,-73.998672' }}", 'https://maps.googleapis.com/maps/api/staticmap?center=40.714728%2C-73.998672&size=600x300')
88
end
99

1010
it 'returns url with zoom' do
11-
expect_template_result("{{ '600x300' | google_static_map_url: zoom: 13 }}", 'https://maps.googleapis.com/maps/api/staticmap?zoom=13')
11+
expect_template_result("{{ '600x300' | google_static_map_url: zoom: 13 }}", 'https://maps.googleapis.com/maps/api/staticmap?size=600x300&zoom=13')
1212
end
1313

1414
it 'returns url with maptype' do
15-
expect_template_result("{{ '600x300' | google_static_map_url: maptype: 'hybrid' }}", 'https://maps.googleapis.com/maps/api/staticmap?maptype=hybrid')
15+
expect_template_result("{{ '600x300' | google_static_map_url: maptype: 'hybrid' }}", 'https://maps.googleapis.com/maps/api/staticmap?maptype=hybrid&size=600x300')
1616
end
1717

1818
it 'returns url with markers' do
19-
expect_template_result("{{ '600x300' | google_static_map_url: markers: 'color:blue|label:S|40.702147,-74.015794;color:green|label:G|40.711614,-74.012318' }}", 'https://maps.googleapis.com/maps/api/staticmap?markers=color%3Ablue%7Clabel%3AS%7C40.702147%2C-74.015794&markers=color%3Agreen%7Clabel%3AG%7C40.711614%2C-74.012318')
19+
expect_template_result("{{ '600x300' | google_static_map_url: markers: 'color:blue|label:S|40.702147,-74.015794;color:green|label:G|40.711614,-74.012318' }}", 'https://maps.googleapis.com/maps/api/staticmap?size=600x300&markers=color%3Ablue%7Clabel%3AS%7C40.702147%2C-74.015794&markers=color%3Agreen%7Clabel%3AG%7C40.711614%2C-74.012318')
2020
end
2121
end
2222
end

0 commit comments

Comments
 (0)