mirror of
https://github.com/redmine/redmine.git
synced 2025-11-15 09:46:02 +01:00
Removes calls to #assert_template and #assigns in integration tests.
git-svn-id: http://svn.redmine.org/redmine/trunk@15727 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -129,7 +129,7 @@ class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base
|
||||
|
||||
get '/users/current', {}, {'X-Redmine-API-Key' => user.api_key, 'X-Redmine-Switch-User' => su.login}
|
||||
assert_response :success
|
||||
assert_equal su, assigns(:user)
|
||||
assert_select 'h2', :text => su.name
|
||||
assert_equal su, User.current
|
||||
end
|
||||
|
||||
@@ -152,7 +152,7 @@ class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base
|
||||
|
||||
get '/users/current', {}, {'X-Redmine-API-Key' => user.api_key, 'X-Redmine-Switch-User' => su.login}
|
||||
assert_response :success
|
||||
assert_equal user, assigns(:user)
|
||||
assert_select 'h2', :text => user.name
|
||||
assert_equal user, User.current
|
||||
end
|
||||
end
|
||||
|
||||
@@ -46,8 +46,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
||||
|
||||
test "GET /issues.xml should contain metadata" do
|
||||
get '/issues.xml'
|
||||
assert_select 'issues[type=array][total_count=?][limit="25"][offset="0"]',
|
||||
assigns(:issue_count).to_s
|
||||
assert_select 'issues[type=array][total_count][limit="25"][offset="0"]'
|
||||
end
|
||||
|
||||
test "GET /issues.xml with nometa param should not contain metadata" do
|
||||
@@ -62,9 +61,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
||||
|
||||
test "GET /issues.xml with offset and limit" do
|
||||
get '/issues.xml?offset=2&limit=3'
|
||||
|
||||
assert_equal 3, assigns(:limit)
|
||||
assert_equal 2, assigns(:offset)
|
||||
assert_select 'issues[type=array][total_count][limit="3"][offset="2"]'
|
||||
assert_select 'issues issue', 3
|
||||
end
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
assert_equal 3, assigns(:roles).size
|
||||
|
||||
assert_select 'roles role', 3
|
||||
assert_select 'roles[type=array] role id', :text => '2' do
|
||||
assert_select '~ name', :text => 'Developer'
|
||||
end
|
||||
@@ -37,11 +37,11 @@ class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base
|
||||
|
||||
assert_response :success
|
||||
assert_equal 'application/json', @response.content_type
|
||||
assert_equal 3, assigns(:roles).size
|
||||
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert_kind_of Hash, json
|
||||
assert_kind_of Array, json['roles']
|
||||
assert_equal 3, json['roles'].size
|
||||
assert_include({'id' => 2, 'name' => 'Developer'}, json['roles'])
|
||||
end
|
||||
|
||||
|
||||
@@ -48,26 +48,26 @@ class Redmine::ApiTest::SearchTest < Redmine::ApiTest::Base
|
||||
get '/search.xml', :q => '', :all_words => ''
|
||||
|
||||
assert_response :success
|
||||
assert_equal 0, assigns(:results).size
|
||||
assert_select 'result', 0
|
||||
end
|
||||
|
||||
test "GET /search.xml with query strings should return results" do
|
||||
get '/search.xml', :q => 'recipe subproject commit', :all_words => ''
|
||||
issue = Issue.generate!(:subject => 'searchapi')
|
||||
|
||||
get '/search.xml', :q => 'searchapi', :all_words => ''
|
||||
|
||||
assert_response :success
|
||||
assert_not_empty(assigns(:results))
|
||||
|
||||
assert_select 'results[type=array]' do
|
||||
assert_select 'result', :count => assigns(:results).count
|
||||
assigns(:results).size.times.each do |i|
|
||||
assert_select 'result' do
|
||||
assert_select 'id', :text => assigns(:results)[i].id.to_s
|
||||
assert_select 'title', :text => assigns(:results)[i].event_title
|
||||
assert_select 'type', :text => assigns(:results)[i].event_type
|
||||
assert_select 'url', :text => url_for(assigns(:results)[i].event_url(:only_path => false))
|
||||
assert_select 'description', :text => assigns(:results)[i].event_description
|
||||
assert_select 'datetime'
|
||||
end
|
||||
assert_select 'result', 1
|
||||
|
||||
assert_select 'result' do
|
||||
assert_select 'id', :text => issue.id.to_s
|
||||
assert_select 'title', :text => "Bug ##{issue.id} (New): searchapi"
|
||||
assert_select 'type', :text => 'issue'
|
||||
assert_select 'url', :text => "http://www.example.com/issues/#{issue.id}"
|
||||
assert_select 'description', :text => ''
|
||||
assert_select 'datetime'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
|
||||
assert_response :success
|
||||
assert_equal 'application/xml', response.content_type
|
||||
assert_select 'users' do
|
||||
assert_select 'user', assigns(:users).size
|
||||
assert_select 'user', User.active.count
|
||||
end
|
||||
end
|
||||
|
||||
@@ -37,7 +37,7 @@ class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base
|
||||
assert_equal 'application/json', response.content_type
|
||||
json = ActiveSupport::JSON.decode(response.body)
|
||||
assert json.key?('users')
|
||||
assert_equal assigns(:users).size, json['users'].size
|
||||
assert_equal User.active.count, json['users'].size
|
||||
end
|
||||
|
||||
test "GET /users/:id.xml should return the user" do
|
||||
|
||||
Reference in New Issue
Block a user