4 class VersionsControllerTest < ActionDispatch::IntegrationTest
6 # test all routes which lead to this controller
9 { :path => "/api/versions", :method => :get },
10 { :controller => "api/versions", :action => "show" }
13 { :path => "/api/versions.json", :method => :get },
14 { :controller => "api/versions", :action => "show", :format => "json" }
17 { :controller => "api/versions", :action => "show" },
18 { :path => "/api/versions", :method => :get }
21 { :controller => "api/versions", :action => "show", :format => "json" },
22 { :path => "/api/versions.json", :method => :get }
28 assert_response :success
29 assert_select "osm[generator='#{Settings.generator}']", :count => 1 do
30 assert_select "api", :count => 1 do
31 assert_select "version", Settings.api_version
36 def test_versions_json
37 get api_versions_path, :params => { :format => "json" }
38 assert_response :success
39 js = ActiveSupport::JSON.decode(@response.body)
41 assert_equal [Settings.api_version], js["api"]["versions"]
44 def test_no_version_in_root_element
46 assert_response :success
47 assert_select "osm[version]", :count => 0
50 def test_versions_available_while_offline
51 with_settings(:status => "api_offline") do
53 assert_response :success
54 assert_select "osm[generator='#{Settings.generator}']", :count => 1 do
55 assert_select "api", :count => 1 do
56 assert_select "version", Settings.api_version