summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-06-12 21:55:39 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-06-12 21:55:39 +0000
commit07d88851bf82f5d3fd5761157d64e7e4a8510b78 (patch)
tree69c1fa980a620896ae6e33c14308486cf6bfd562
parente978b3ace0e8632bec90d3894c0a2dc1de13a4ea (diff)
downloadredmine-07d88851bf82f5d3fd5761157d64e7e4a8510b78.tar.gz
redmine-07d88851bf82f5d3fd5761157d64e7e4a8510b78.zip
Fixed tests broken by r11965.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11966 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/user.rb7
-rw-r--r--test/unit/search_test.rb2
2 files changed, 4 insertions, 5 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index b5d600395..f8813b167 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -136,6 +136,7 @@ class User < Principal
@membership_by_project_id = nil
@notified_projects_ids = nil
@notified_projects_ids_changed = false
+ @builtin_role = nil
base_reload(*args)
end
@@ -444,11 +445,7 @@ class User < Principal
# Returns the user's bult-in role
def builtin_role
- if logged?
- @role_non_member ||= Role.non_member
- else
- @role_anonymous ||= Role.anonymous
- end
+ @builtin_role ||= (logged? ? Role.non_member : Role.anonymous)
end
# Return user's roles for project
diff --git a/test/unit/search_test.rb b/test/unit/search_test.rb
index fda9ea56f..f461fa843 100644
--- a/test/unit/search_test.rb
+++ b/test/unit/search_test.rb
@@ -49,6 +49,7 @@ class SearchTest < ActiveSupport::TestCase
# Removes the :view_changesets permission from Anonymous role
remove_permission Role.anonymous, :view_changesets
+ User.current = nil
r = Issue.search(@issue_keyword).first
assert r.include?(@issue)
@@ -74,6 +75,7 @@ class SearchTest < ActiveSupport::TestCase
# Removes the :view_changesets permission from Non member role
remove_permission Role.non_member, :view_changesets
+ User.current = User.find_by_login('rhill')
r = Issue.search(@issue_keyword).first
assert r.include?(@issue)