]> source.dussan.org Git - redmine.git/commitdiff
Fixed tests broken by r11965.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 12 Jun 2013 21:55:39 +0000 (21:55 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 12 Jun 2013 21:55:39 +0000 (21:55 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11966 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/user.rb
test/unit/search_test.rb

index b5d6003950e701db5d81aa2e3ff62f9024fc42b2..f8813b167e2746b8e9643af1923f12268b3d1c45 100644 (file)
@@ -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
index fda9ea56f3be85e824bc8990676ad0cbe0131ea1..f461fa843125ac7808027405bab1e10dc468fa45 100644 (file)
@@ -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)