summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-05-03 00:44:08 +0000
committerGo MAEDA <maeda@farend.jp>2020-05-03 00:44:08 +0000
commite9e0c538da70361ebfbe4f1a21f1818724512943 (patch)
treef69b678914977addf58537689a61c0e3e37c0164 /test/unit/issue_test.rb
parent16789259ccde7a9a42d82e2b803f0d8d097f2777 (diff)
downloadredmine-e9e0c538da70361ebfbe4f1a21f1818724512943.tar.gz
redmine-e9e0c538da70361ebfbe4f1a21f1818724512943.zip
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
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index aea76e34f..d82f6e079 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -248,14 +248,14 @@ class IssueTest < ActiveSupport::TestCase
def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_default
Role.anonymous.update!(:issues_visibility => 'default')
issue = Issue.generate!(:author => User.anonymous, :is_private => true)
- assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
+ assert_not Issue.where(:id => issue.id).visible(User.anonymous).exists?
assert !issue.visible?(User.anonymous)
end
def test_anonymous_should_not_see_private_issues_with_issues_visibility_set_to_own
assert Role.anonymous.update!(:issues_visibility => 'own')
issue = Issue.generate!(:author => User.anonymous, :is_private => true)
- assert_nil Issue.where(:id => issue.id).visible(User.anonymous).first
+ assert_not Issue.where(:id => issue.id).visible(User.anonymous).exists?
assert !issue.visible?(User.anonymous)
end