Rails4: replace deprecated Relation#update_all at IssuesControllerTest

git-svn-id: http://svn.redmine.org/redmine/trunk@12519 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-01-08 06:03:54 +00:00
parent d731c036fb
commit c92f425309
1 changed files with 6 additions and 6 deletions

View File

@ -1026,7 +1026,7 @@ class IssuesControllerTest < ActionController::TestCase
end end
def test_show_should_deny_anonymous_access_to_private_issue def test_show_should_deny_anonymous_access_to_private_issue
Issue.update_all(["is_private = ?", true], "id = 1") Issue.where(:id => 1).update_all(["is_private = ?", true])
get :show, :id => 1 get :show, :id => 1
assert_response :redirect assert_response :redirect
end end
@ -1039,7 +1039,7 @@ class IssuesControllerTest < ActionController::TestCase
end end
def test_show_should_deny_non_member_access_to_private_issue def test_show_should_deny_non_member_access_to_private_issue
Issue.update_all(["is_private = ?", true], "id = 1") Issue.where(:id => 1).update_all(["is_private = ?", true])
@request.session[:user_id] = 9 @request.session[:user_id] = 9
get :show, :id => 1 get :show, :id => 1
assert_response 403 assert_response 403
@ -1053,28 +1053,28 @@ class IssuesControllerTest < ActionController::TestCase
end end
def test_show_should_deny_member_access_to_private_issue_without_permission def test_show_should_deny_member_access_to_private_issue_without_permission
Issue.update_all(["is_private = ?", true], "id = 1") Issue.where(:id => 1).update_all(["is_private = ?", true])
@request.session[:user_id] = 3 @request.session[:user_id] = 3
get :show, :id => 1 get :show, :id => 1
assert_response 403 assert_response 403
end end
def test_show_should_allow_author_access_to_private_issue def test_show_should_allow_author_access_to_private_issue
Issue.update_all(["is_private = ?, author_id = 3", true], "id = 1") Issue.where(:id => 1).update_all(["is_private = ?, author_id = 3", true])
@request.session[:user_id] = 3 @request.session[:user_id] = 3
get :show, :id => 1 get :show, :id => 1
assert_response :success assert_response :success
end end
def test_show_should_allow_assignee_access_to_private_issue def test_show_should_allow_assignee_access_to_private_issue
Issue.update_all(["is_private = ?, assigned_to_id = 3", true], "id = 1") Issue.where(:id => 1).update_all(["is_private = ?, assigned_to_id = 3", true])
@request.session[:user_id] = 3 @request.session[:user_id] = 3
get :show, :id => 1 get :show, :id => 1
assert_response :success assert_response :success
end end
def test_show_should_allow_member_access_to_private_issue_with_permission def test_show_should_allow_member_access_to_private_issue_with_permission
Issue.update_all(["is_private = ?", true], "id = 1") Issue.where(:id => 1).update_all(["is_private = ?", true])
User.find(3).roles_for_project(Project.find(1)).first.update_attribute :issues_visibility, 'all' User.find(3).roles_for_project(Project.find(1)).first.update_attribute :issues_visibility, 'all'
@request.session[:user_id] = 3 @request.session[:user_id] = 3
get :show, :id => 1 get :show, :id => 1