This will eventually replace the unversioned 'capabilities' call. Client applications can use this versions call to find out what versions are available, if they support multiple versions. The capabilities of each version, and the format of the capabilities call, is then able to change between versions. If a client only supports one version they can jump straight to the versioned capabilities call. Additionally, supported versions are now a list of version identifiers, without any implications surrounding min/max values (e.g. guesswork for supported intermediate versions). Fixes #2162
34 lines
907 B
Ruby
34 lines
907 B
Ruby
require "test_helper"
|
|
|
|
module Api
|
|
class VersionsControllerTest < ActionController::TestCase
|
|
##
|
|
# test all routes which lead to this controller
|
|
def test_routes
|
|
assert_routing(
|
|
{ :path => "/api/versions", :method => :get },
|
|
{ :controller => "api/versions", :action => "show" }
|
|
)
|
|
assert_recognizes(
|
|
{ :controller => "api/versions", :action => "show" },
|
|
{ :path => "/api/versions", :method => :get }
|
|
)
|
|
end
|
|
|
|
def test_versions
|
|
get :show
|
|
assert_response :success
|
|
assert_select "osm[generator='#{Settings.generator}']", :count => 1 do
|
|
assert_select "api", :count => 1 do
|
|
assert_select "version", Settings.api_version
|
|
end
|
|
end
|
|
end
|
|
|
|
def test_no_version_in_root_element
|
|
get :show
|
|
assert_response :success
|
|
assert_select "osm[version]", :count => 0
|
|
end
|
|
end
|
|
end
|