diff options
Diffstat (limited to 'test/integration/api_test/users_test.rb')
-rw-r--r-- | test/integration/api_test/users_test.rb | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 2fab3f80c..f44948c54 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -67,8 +67,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base get '/users/2.xml' assert_response :success - assert_tag :tag => 'user', - :child => {:tag => 'id', :content => '2'} + assert_select 'user id', :text => '2' end test "GET /users/:id.json should return the user" do @@ -85,9 +84,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base get '/users/2.xml?include=memberships' assert_response :success - assert_tag :tag => 'memberships', - :parent => {:tag => 'user'}, - :children => {:count => 1} + assert_select 'user memberships', 1 end test "GET /users/:id.json with include=memberships should include memberships" do @@ -112,44 +109,43 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base test "GET /users/current.xml should return current user" do get '/users/current.xml', {}, credentials('jsmith') - assert_tag :tag => 'user', - :child => {:tag => 'id', :content => '2'} + assert_select 'user id', :text => '2' end test "GET /users/:id should not return login for other user" do get '/users/3.xml', {}, credentials('jsmith') assert_response :success - assert_no_tag 'user', :child => {:tag => 'login'} + assert_select 'user login', 0 end test "GET /users/:id should return login for current user" do get '/users/2.xml', {}, credentials('jsmith') assert_response :success - assert_tag 'user', :child => {:tag => 'login', :content => 'jsmith'} + assert_select 'user login', :text => 'jsmith' end test "GET /users/:id should not return api_key for other user" do get '/users/3.xml', {}, credentials('jsmith') assert_response :success - assert_no_tag 'user', :child => {:tag => 'api_key'} + assert_select 'user api_key', 0 end test "GET /users/:id should return api_key for current user" do get '/users/2.xml', {}, credentials('jsmith') assert_response :success - assert_tag 'user', :child => {:tag => 'api_key', :content => User.find(2).api_key} + assert_select 'user api_key', :text => User.find(2).api_key end test "GET /users/:id should not return status for standard user" do get '/users/3.xml', {}, credentials('jsmith') assert_response :success - assert_no_tag 'user', :child => {:tag => 'status'} + assert_select 'user status', 0 end test "GET /users/:id should return status for administrators" do get '/users/2.xml', {}, credentials('admin') assert_response :success - assert_tag 'user', :child => {:tag => 'status', :content => User.find(1).status.to_s} + assert_select 'user status', :text => User.find(1).status.to_s end test "POST /users.xml with valid parameters should create the user" do @@ -174,7 +170,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert_response :created assert_equal 'application/xml', @response.content_type - assert_tag 'user', :child => {:tag => 'id', :content => user.id.to_s} + assert_select 'user id', :text => user.id.to_s end test "POST /users.json with valid parameters should create the user" do @@ -210,10 +206,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type - assert_tag 'errors', :child => { - :tag => 'error', - :content => "First name can't be blank" - } + assert_select 'errors error', :text => "First name can't be blank" end test "POST /users.json with with invalid parameters should return errors" do @@ -283,10 +276,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base assert_response :unprocessable_entity assert_equal 'application/xml', @response.content_type - assert_tag 'errors', :child => { - :tag => 'error', - :content => "First name can't be blank" - } + assert_select 'errors error', :text => "First name can't be blank" end test "PUT /users/:id.json with invalid parameters" do |