]> git.openstreetmap.org Git - rails.git/blob - test/functional/export_controller_test.rb
Return GPX traces as application/gpx+xml instead of text/xml
[rails.git] / test / functional / export_controller_test.rb
1 require File.dirname(__FILE__) + '/../test_helper'
2
3 class ExportControllerTest < ActionController::TestCase
4
5   ##
6   # test all routes which lead to this controller
7   def test_routes
8     assert_routing(
9       { :path => "/export/start", :method => :get },
10       { :controller => "export", :action => "start" }
11     )
12     assert_routing(
13       { :path => "/export/finish", :method => :post },
14       { :controller => "export", :action => "finish" }
15     )
16     assert_routing(
17       { :path => "/export/embed", :method => :get },
18       { :controller => "export", :action => "embed" }
19     )
20   end
21
22   ##
23   # test the start action
24   def test_start
25     xhr :get, :start
26     assert_response :success
27     assert_template "export/start"
28   end
29   
30   ###
31   # test the finish action for raw OSM data
32   def test_finish_osm
33     get :finish, {:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => 'osm'}
34     assert_response :redirect
35     assert_redirected_to "http://api.openstreetmap.org/api/#{API_VERSION}/map?bbox=0.0,50.0,1.0,51.0"
36   end
37   
38   ###
39   # test the finish action for mapnik images
40   def test_finish_mapnik
41     get :finish, {:minlon => 0, :minlat => 50, :maxlon => 1, :maxlat => 51, :format => 'mapnik', :mapnik_format => 'test', :mapnik_scale => '12'}
42     assert_response :redirect
43     assert_redirected_to "http://render.openstreetmap.org/cgi-bin/export?bbox=0.0,50.0,1.0,51.0&scale=12&format=test"
44   end
45
46   ##
47   # test the embed action
48   def test_embed
49     get :embed
50     assert_response :success
51     assert_template "export/embed"
52   end
53
54 end