X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/b70da7b8ea15ab48bb2f34155567cea6dffc8fc9..134f9e2df1b3d3c797e7fbb1cf2de3d76a018330:/test/controllers/api/versions_controller_test.rb?ds=inline diff --git a/test/controllers/api/versions_controller_test.rb b/test/controllers/api/versions_controller_test.rb index a1a616ad1..1c70831c9 100644 --- a/test/controllers/api/versions_controller_test.rb +++ b/test/controllers/api/versions_controller_test.rb @@ -9,10 +9,18 @@ module Api { :path => "/api/versions", :method => :get }, { :controller => "api/versions", :action => "show" } ) + assert_routing( + { :path => "/api/versions.json", :method => :get }, + { :controller => "api/versions", :action => "show", :format => "json" } + ) assert_recognizes( { :controller => "api/versions", :action => "show" }, { :path => "/api/versions", :method => :get } ) + assert_recognizes( + { :controller => "api/versions", :action => "show", :format => "json" }, + { :path => "/api/versions.json", :method => :get } + ) end def test_versions @@ -25,6 +33,14 @@ module Api end end + def test_versions_json + get api_versions_path, :params => { :format => "json" } + assert_response :success + js = ActiveSupport::JSON.decode(@response.body) + assert_not_nil js + assert_equal [Settings.api_version], js["api"]["versions"] + end + def test_no_version_in_root_element get api_versions_path assert_response :success