diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-01 20:09:08 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-01 20:09:08 +0000 |
commit | 42d3f7e5040ce10d889e9070103dd46a9e11a2b7 (patch) | |
tree | fc155fea121c6e0d7be64a26b070a8cb1c907d47 /test/functional | |
parent | dd92a53b14660bb3db6ca03ffe778cd18b0dbf1e (diff) | |
download | redmine-42d3f7e5040ce10d889e9070103dd46a9e11a2b7.tar.gz redmine-42d3f7e5040ce10d889e9070103dd46a9e11a2b7.zip |
Use JSON instead of XML for reposman.rb.
git-svn-id: http://svn.redmine.org/redmine/trunk@16591 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional')
-rw-r--r-- | test/functional/sys_controller_test.rb | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/test/functional/sys_controller_test.rb b/test/functional/sys_controller_test.rb index becd4ec42..8bd1aedf9 100644 --- a/test/functional/sys_controller_test.rb +++ b/test/functional/sys_controller_test.rb @@ -32,17 +32,17 @@ class SysControllerTest < Redmine::ControllerTest def test_projects_with_repository_enabled get :projects assert_response :success - assert_equal 'application/xml', @response.content_type - - assert_select 'projects' do - assert_select 'project', Project.active.has_module(:repository).count - assert_select 'project' do - assert_select 'identifier' - assert_select 'is-public' - end - end - assert_select 'extra-info', 0 - assert_select 'extra_info', 0 + assert_equal 'application/json', @response.content_type + + data = ActiveSupport::JSON.decode(response.body) + + assert_equal Project.active.has_module(:repository).count, data.size + project = data.first + assert project['identifier'] + assert project['is_public'] + + assert_not_include 'extra-info', response.body + assert_not_include 'extra_info', response.body end def test_create_project_repository @@ -54,18 +54,19 @@ class SysControllerTest < Redmine::ControllerTest :repository => { :url => 'file:///create/project/repository/subproject2'} } assert_response :created - assert_equal 'application/xml', @response.content_type + assert_equal 'application/json', @response.content_type r = Project.find(4).repository assert r.is_a?(Repository::Subversion) assert_equal 'file:///create/project/repository/subproject2', r.url - - assert_select 'repository-subversion' do - assert_select 'id', :text => r.id.to_s - assert_select 'url', :text => r.url - end - assert_select 'extra-info', 0 - assert_select 'extra_info', 0 + + data = ActiveSupport::JSON.decode(response.body) + assert data['repository-subversion'] + assert_equal r.id, data['repository-subversion']['id'] + assert_equal r.url, data['repository-subversion']['url'] + + assert_not_include 'extra-info', response.body + assert_not_include 'extra_info', response.body end def test_create_already_existing |