Use more efficient "exists?" instead of "first" in tests when checking the existence of rows (#33367).

Patch by Go MAEDA.


git-svn-id: http://svn.redmine.org/redmine/trunk@19746 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2020-05-03 00:44:08 +00:00
parent 16789259cc
commit e9e0c538da
8 changed files with 22 additions and 22 deletions

View File

@@ -145,8 +145,8 @@ class WorkflowsControllerTest < Redmine::ControllerTest
assert_response 302
assert_equal 3, WorkflowTransition.where(:tracker_id => 1, :role_id => 2).count
assert_not_nil WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2).first
assert_nil WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4).first
assert WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 3, :new_status_id => 2).exists?
assert_not WorkflowTransition.where(:role_id => 2, :tracker_id => 1, :old_status_id => 5, :new_status_id => 4).exists?
end
def test_post_edit_with_allowed_statuses_for_new_issues