diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-22 17:37:16 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-22 17:37:16 +0000 |
commit | 2d1866d966d94c688f9cb87c5bf3f096dffac844 (patch) | |
tree | 7a733c1cc51448ab69b3f892285305dbfb0ae15e /test/unit/journal_test.rb | |
parent | a6ec78a4dc658e3517ed682792016b6530458696 (diff) | |
download | redmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.tar.gz redmine-2d1866d966d94c688f9cb87c5bf3f096dffac844.zip |
Merged rails-4.1 branch (#14534).
git-svn-id: http://svn.redmine.org/redmine/trunk@13482 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/journal_test.rb')
-rw-r--r-- | test/unit/journal_test.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb index ccfd2635f..36f494807 100644 --- a/test/unit/journal_test.rb +++ b/test/unit/journal_test.rb @@ -27,6 +27,7 @@ class JournalTest < ActiveSupport::TestCase def setup @journal = Journal.find 1 + User.current = nil end def test_journalized_is_an_issue @@ -119,12 +120,12 @@ class JournalTest < ActiveSupport::TestCase def test_visible_scope_for_anonymous # Anonymous user should see issues of public projects only - journals = Journal.visible(User.anonymous).all + journals = Journal.visible(User.anonymous).to_a assert journals.any? assert_nil journals.detect {|journal| !journal.issue.project.is_public?} # Anonymous user should not see issues without permission Role.anonymous.remove_permission!(:view_issues) - journals = Journal.visible(User.anonymous).all + journals = Journal.visible(User.anonymous).to_a assert journals.empty? end @@ -132,18 +133,18 @@ class JournalTest < ActiveSupport::TestCase user = User.find(9) assert user.projects.empty? # Non member user should see issues of public projects only - journals = Journal.visible(user).all + journals = Journal.visible(user).to_a assert journals.any? assert_nil journals.detect {|journal| !journal.issue.project.is_public?} # Non member user should not see issues without permission Role.non_member.remove_permission!(:view_issues) user.reload - journals = Journal.visible(user).all + journals = Journal.visible(user).to_a assert journals.empty? # User should see issues of projects for which user has view_issues permissions only Member.create!(:principal => user, :project_id => 1, :role_ids => [1]) user.reload - journals = Journal.visible(user).all + journals = Journal.visible(user).to_a assert journals.any? assert_nil journals.detect {|journal| journal.issue.project_id != 1} end @@ -152,7 +153,7 @@ class JournalTest < ActiveSupport::TestCase user = User.find(1) user.members.each(&:destroy) assert user.projects.empty? - journals = Journal.visible(user).all + journals = Journal.visible(user).to_a assert journals.any? # Admin should see issues on private projects that admin does not belong to assert journals.detect {|journal| !journal.issue.project.is_public?} |