diff options
Diffstat (limited to 'test/unit')
63 files changed, 146 insertions, 0 deletions
diff --git a/test/unit/activity_test.rb b/test/unit/activity_test.rb index a14203d4c..3c1402173 100644 --- a/test/unit/activity_test.rb +++ b/test/unit/activity_test.rb @@ -23,6 +23,7 @@ class ActivityTest < ActiveSupport::TestCase :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions def setup + User.current = nil @project = Project.find(1) end diff --git a/test/unit/attachment_transaction_test.rb b/test/unit/attachment_transaction_test.rb index b0f13332f..173d2a658 100644 --- a/test/unit/attachment_transaction_test.rb +++ b/test/unit/attachment_transaction_test.rb @@ -26,6 +26,7 @@ class AttachmentTest < ActiveSupport::TestCase self.use_transactional_tests = false def setup + User.current = nil set_tmp_attachments_directory end diff --git a/test/unit/auth_source_ldap_test.rb b/test/unit/auth_source_ldap_test.rb index f6eefed02..322568226 100644 --- a/test/unit/auth_source_ldap_test.rb +++ b/test/unit/auth_source_ldap_test.rb @@ -22,6 +22,7 @@ class AuthSourceLdapTest < ActiveSupport::TestCase fixtures :auth_sources def setup + User.current = nil end def test_initialize diff --git a/test/unit/board_test.rb b/test/unit/board_test.rb index c66e70071..35c2da9fa 100644 --- a/test/unit/board_test.rb +++ b/test/unit/board_test.rb @@ -25,6 +25,7 @@ class BoardTest < ActiveSupport::TestCase include Redmine::I18n def setup + User.current = nil @project = Project.find(1) end diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb index a1c3cf8dc..c246a0c70 100644 --- a/test/unit/changeset_test.rb +++ b/test/unit/changeset_test.rb @@ -32,6 +32,10 @@ class ChangesetTest < ActiveSupport::TestCase :trackers, :projects_trackers, :enabled_modules, :roles + def setup + User.current = nil + end + def test_ref_keywords_any ActionMailer::Base.deliveries.clear Setting.commit_ref_keywords = '*' diff --git a/test/unit/comment_test.rb b/test/unit/comment_test.rb index 182173866..6e97df612 100644 --- a/test/unit/comment_test.rb +++ b/test/unit/comment_test.rb @@ -22,6 +22,7 @@ class CommentTest < ActiveSupport::TestCase :user_preferences, :roles, :members, :member_roles def setup + User.current = nil @jsmith = User.find(2) @news = News.find(1) end diff --git a/test/unit/custom_field_user_format_test.rb b/test/unit/custom_field_user_format_test.rb index 8827e9737..a3d161de3 100644 --- a/test/unit/custom_field_user_format_test.rb +++ b/test/unit/custom_field_user_format_test.rb @@ -21,6 +21,7 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase fixtures :custom_fields, :projects, :members, :users, :member_roles, :trackers, :issues def setup + User.current = nil @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user') end diff --git a/test/unit/custom_field_version_format_test.rb b/test/unit/custom_field_version_format_test.rb index 761d0ab5b..4e09bed05 100644 --- a/test/unit/custom_field_version_format_test.rb +++ b/test/unit/custom_field_version_format_test.rb @@ -21,6 +21,7 @@ class CustomFieldVersionFormatTest < ActiveSupport::TestCase fixtures :custom_fields, :projects, :members, :users, :member_roles, :trackers, :issues, :versions def setup + User.current = nil @field = IssueCustomField.create!(:name => 'Tester', :field_format => 'version') end diff --git a/test/unit/custom_value_test.rb b/test/unit/custom_value_test.rb index b22cc4225..14964ed09 100644 --- a/test/unit/custom_value_test.rb +++ b/test/unit/custom_value_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class CustomValueTest < ActiveSupport::TestCase fixtures :custom_fields, :custom_values, :users + def setup + User.current = nil + end + def test_new_without_value_should_set_default_value field = CustomField.generate!(:default_value => 'Default string') diff --git a/test/unit/default_data_test.rb b/test/unit/default_data_test.rb index f7aea7685..6a6a223bd 100644 --- a/test/unit/default_data_test.rb +++ b/test/unit/default_data_test.rb @@ -21,6 +21,10 @@ class DefaultDataTest < ActiveSupport::TestCase include Redmine::I18n fixtures :roles + def setup + User.current = nil + end + def test_no_data assert !Redmine::DefaultData::Loader::no_data? clear_data diff --git a/test/unit/document_category_test.rb b/test/unit/document_category_test.rb index 6a9eb0935..305d827da 100644 --- a/test/unit/document_category_test.rb +++ b/test/unit/document_category_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class DocumentCategoryTest < ActiveSupport::TestCase fixtures :enumerations, :documents, :issues + def setup + User.current = nil + end + def test_should_be_an_enumeration assert DocumentCategory.ancestors.include?(Enumeration) end diff --git a/test/unit/enabled_module_test.rb b/test/unit/enabled_module_test.rb index eae68fbc8..79995dbf2 100644 --- a/test/unit/enabled_module_test.rb +++ b/test/unit/enabled_module_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class EnabledModuleTest < ActiveSupport::TestCase fixtures :projects, :trackers, :issue_statuses, :wikis + def setup + User.current = nil + end + def test_enabling_wiki_should_create_a_wiki CustomField.delete_all project = Project.create!(:name => 'Project with wiki', :identifier => 'wikiproject', :enabled_module_names => []) diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb index 3efba77b7..7eeafd2af 100644 --- a/test/unit/enumeration_test.rb +++ b/test/unit/enumeration_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class EnumerationTest < ActiveSupport::TestCase fixtures :enumerations, :issues, :custom_fields, :custom_values + def setup + User.current = nil + end + def test_objects_count # low priority assert_equal 6, Enumeration.find(4).objects_count diff --git a/test/unit/group_test.rb b/test/unit/group_test.rb index 8756f31e7..f706826ce 100644 --- a/test/unit/group_test.rb +++ b/test/unit/group_test.rb @@ -28,6 +28,10 @@ class GroupTest < ActiveSupport::TestCase include Redmine::I18n + def setup + User.current = nil + end + def test_create g = Group.new(:name => 'New group') assert g.save diff --git a/test/unit/issue_category_test.rb b/test/unit/issue_category_test.rb index 1340ea84f..2d0316882 100644 --- a/test/unit/issue_category_test.rb +++ b/test/unit/issue_category_test.rb @@ -21,6 +21,7 @@ class IssueCategoryTest < ActiveSupport::TestCase fixtures :issue_categories, :issues, :users, :groups_users def setup + User.current = nil @category = IssueCategory.find(1) end diff --git a/test/unit/issue_custom_field_test.rb b/test/unit/issue_custom_field_test.rb index 107d47d82..4ecce3b5e 100644 --- a/test/unit/issue_custom_field_test.rb +++ b/test/unit/issue_custom_field_test.rb @@ -22,6 +22,11 @@ class IssueCustomFieldTest < ActiveSupport::TestCase fixtures :roles + def setup + User.current = nil + @category = IssueCategory.find(1) + end + def test_custom_field_with_visible_set_to_false_should_validate_roles set_language_if_valid 'en' field = IssueCustomField.new(:name => 'Field', :field_format => 'string', :visible => false) diff --git a/test/unit/issue_import_test.rb b/test/unit/issue_import_test.rb index 4a038a170..d4b4db69c 100644 --- a/test/unit/issue_import_test.rb +++ b/test/unit/issue_import_test.rb @@ -35,6 +35,7 @@ class IssueImportTest < ActiveSupport::TestCase include Redmine::I18n def setup + User.current = nil set_language_if_valid 'en' end diff --git a/test/unit/issue_nested_set_concurrency_test.rb b/test/unit/issue_nested_set_concurrency_test.rb index 125131eae..b35cbadbd 100644 --- a/test/unit/issue_nested_set_concurrency_test.rb +++ b/test/unit/issue_nested_set_concurrency_test.rb @@ -28,6 +28,7 @@ class IssueNestedSetConcurrencyTest < ActiveSupport::TestCase def setup skip if sqlite? || mysql? + User.current = nil CustomField.delete_all end diff --git a/test/unit/issue_priority_test.rb b/test/unit/issue_priority_test.rb index 0617506f1..3141344f4 100644 --- a/test/unit/issue_priority_test.rb +++ b/test/unit/issue_priority_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class IssuePriorityTest < ActiveSupport::TestCase fixtures :enumerations, :issues + def setup + User.current = nil + end + def test_named_scope assert_equal Enumeration.find_by_name('Normal'), Enumeration.named('normal').first end diff --git a/test/unit/issue_relation_test.rb b/test/unit/issue_relation_test.rb index 585a8293e..6e6322885 100644 --- a/test/unit/issue_relation_test.rb +++ b/test/unit/issue_relation_test.rb @@ -33,6 +33,10 @@ class IssueRelationTest < ActiveSupport::TestCase include Redmine::I18n + def setup + User.current = nil + end + def test_create from = Issue.find(1) to = Issue.find(2) diff --git a/test/unit/issue_scopes_test.rb b/test/unit/issue_scopes_test.rb index f8460b9e0..19253645f 100644 --- a/test/unit/issue_scopes_test.rb +++ b/test/unit/issue_scopes_test.rb @@ -26,6 +26,10 @@ class IssueScopesTest < ActiveSupport::TestCase :issues, :custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values + def setup + User.current = nil + end + def test_cross_project_scope_without_project_should_return_all_issues ids = Issue.cross_project_scope(nil).pluck(:id).sort assert_equal Issue.pluck(:id).sort, ids diff --git a/test/unit/issue_status_test.rb b/test/unit/issue_status_test.rb index 52b65900a..27441366f 100644 --- a/test/unit/issue_status_test.rb +++ b/test/unit/issue_status_test.rb @@ -28,6 +28,10 @@ class IssueStatusTest < ActiveSupport::TestCase :issues, :journals, :journal_details, :custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values + def setup + User.current = nil + end + def test_create status = IssueStatus.new :name => "Assigned" assert !status.save diff --git a/test/unit/issue_subtasking_test.rb b/test/unit/issue_subtasking_test.rb index 00d64a052..b1c3d179d 100644 --- a/test/unit/issue_subtasking_test.rb +++ b/test/unit/issue_subtasking_test.rb @@ -25,6 +25,10 @@ class IssueSubtaskingTest < ActiveSupport::TestCase :enabled_modules, :workflows + def setup + User.current = nil + end + def test_leaf_planning_fields_should_be_editable issue = Issue.generate! user = User.find(1) diff --git a/test/unit/issue_transaction_test.rb b/test/unit/issue_transaction_test.rb index f944ffe8e..719e4dbc5 100644 --- a/test/unit/issue_transaction_test.rb +++ b/test/unit/issue_transaction_test.rb @@ -29,6 +29,10 @@ class IssueTransactionTest < ActiveSupport::TestCase self.use_transactional_tests = false + def setup + User.current = nil + end + def test_invalid_move_to_another_project lft1 = new_issue_lft parent1 = Issue.generate! diff --git a/test/unit/journal_observer_test.rb b/test/unit/journal_observer_test.rb index 17695538a..a03fa402b 100644 --- a/test/unit/journal_observer_test.rb +++ b/test/unit/journal_observer_test.rb @@ -23,6 +23,7 @@ class JournalObserverTest < ActiveSupport::TestCase :users, :email_addresses, :roles def setup + User.current = nil ActionMailer::Base.deliveries.clear @journal = Journal.find 1 end diff --git a/test/unit/lib/redmine/field_format/attachment_format_visibility_test.rb b/test/unit/lib/redmine/field_format/attachment_format_visibility_test.rb index 4ce4062bb..8d883f95a 100644 --- a/test/unit/lib/redmine/field_format/attachment_format_visibility_test.rb +++ b/test/unit/lib/redmine/field_format/attachment_format_visibility_test.rb @@ -26,6 +26,7 @@ class AttachmentFormatVisibilityTest < ActionView::TestCase :versions, :issues def setup + User.current = nil set_tmp_attachments_directory end diff --git a/test/unit/lib/redmine/field_format/bool_format_test.rb b/test/unit/lib/redmine/field_format/bool_format_test.rb index 9041c81e8..2458de1ed 100644 --- a/test/unit/lib/redmine/field_format/bool_format_test.rb +++ b/test/unit/lib/redmine/field_format/bool_format_test.rb @@ -23,6 +23,7 @@ class Redmine::BoolFieldFormatTest < ActionView::TestCase include Redmine::I18n def setup + User.current = nil set_language_if_valid 'en' end diff --git a/test/unit/lib/redmine/field_format/enumeration_format_test.rb b/test/unit/lib/redmine/field_format/enumeration_format_test.rb index bc9a498d1..9b977b221 100644 --- a/test/unit/lib/redmine/field_format/enumeration_format_test.rb +++ b/test/unit/lib/redmine/field_format/enumeration_format_test.rb @@ -22,6 +22,7 @@ class Redmine::EnumerationFieldFormatTest < ActionView::TestCase include ApplicationHelper def setup + User.current = nil set_language_if_valid 'en' @field = IssueCustomField.create!(:name => 'List', :field_format => 'enumeration', :is_required => false) @foo = CustomFieldEnumeration.new(:name => 'Foo') diff --git a/test/unit/lib/redmine/field_format/field_format_test.rb b/test/unit/lib/redmine/field_format/field_format_test.rb index f06638944..7d98f2585 100644 --- a/test/unit/lib/redmine/field_format/field_format_test.rb +++ b/test/unit/lib/redmine/field_format/field_format_test.rb @@ -21,6 +21,7 @@ class Redmine::FieldFormatTest < ActionView::TestCase include ApplicationHelper def setup + User.current = nil set_language_if_valid 'en' end diff --git a/test/unit/lib/redmine/field_format/link_format_test.rb b/test/unit/lib/redmine/field_format/link_format_test.rb index d5758be17..aa7e8de52 100644 --- a/test/unit/lib/redmine/field_format/link_format_test.rb +++ b/test/unit/lib/redmine/field_format/link_format_test.rb @@ -19,6 +19,11 @@ require File.expand_path('../../../../../test_helper', __FILE__) require 'redmine/field_format' class Redmine::LinkFieldFormatTest < ActionView::TestCase + + def setup + User.current = nil + end + def test_link_field_should_substitute_value field = IssueCustomField.new(:field_format => 'link', :url_pattern => 'http://foo/%value%') custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "bar") diff --git a/test/unit/lib/redmine/field_format/list_format_test.rb b/test/unit/lib/redmine/field_format/list_format_test.rb index 8a19e3527..06a7fbda4 100644 --- a/test/unit/lib/redmine/field_format/list_format_test.rb +++ b/test/unit/lib/redmine/field_format/list_format_test.rb @@ -23,6 +23,7 @@ class Redmine::ListFieldFormatTest < ActionView::TestCase include Redmine::I18n def setup + User.current = nil set_language_if_valid 'en' end diff --git a/test/unit/lib/redmine/field_format/numeric_format_test.rb b/test/unit/lib/redmine/field_format/numeric_format_test.rb index e6572d8c6..72e2148d5 100644 --- a/test/unit/lib/redmine/field_format/numeric_format_test.rb +++ b/test/unit/lib/redmine/field_format/numeric_format_test.rb @@ -21,6 +21,10 @@ require 'redmine/field_format' class Redmine::NumericFieldFormatTest < ActionView::TestCase
include ApplicationHelper
+ def setup
+ User.current = nil
+ end
+
def test_integer_field_with_url_pattern_should_format_as_link
field = IssueCustomField.new(:field_format => 'int', :url_pattern => 'http://foo/%value%')
custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "3")
diff --git a/test/unit/lib/redmine/field_format/user_field_format_test.rb b/test/unit/lib/redmine/field_format/user_field_format_test.rb index 2612bb475..e545c6d4f 100644 --- a/test/unit/lib/redmine/field_format/user_field_format_test.rb +++ b/test/unit/lib/redmine/field_format/user_field_format_test.rb @@ -25,6 +25,10 @@ class Redmine::UserFieldFormatTest < ActionView::TestCase :enumerations, :custom_fields, :custom_fields_trackers, :custom_fields_projects + def setup + User.current = nil + end + def test_user_role_should_reject_blank_values field = IssueCustomField.new(:name => 'Foo', :field_format => 'user', :user_role => ["1", ""]) field.save! diff --git a/test/unit/member_test.rb b/test/unit/member_test.rb index ad804f64d..ab6bf8473 100644 --- a/test/unit/member_test.rb +++ b/test/unit/member_test.rb @@ -35,6 +35,7 @@ class MemberTest < ActiveSupport::TestCase include Redmine::I18n def setup + User.current = nil @jsmith = Member.find(1) end diff --git a/test/unit/message_test.rb b/test/unit/message_test.rb index 254feb218..8d7073c2e 100644 --- a/test/unit/message_test.rb +++ b/test/unit/message_test.rb @@ -22,6 +22,7 @@ class MessageTest < ActiveSupport::TestCase :users, :watchers, :enabled_modules def setup + User.current = nil @board = Board.find(1) @user = User.find(1) end diff --git a/test/unit/news_test.rb b/test/unit/news_test.rb index 03a868a91..16e55dea3 100644 --- a/test/unit/news_test.rb +++ b/test/unit/news_test.rb @@ -25,6 +25,7 @@ class NewsTest < ActiveSupport::TestCase end def setup + User.current = nil end def test_create_should_send_email_notification diff --git a/test/unit/project_members_inheritance_test.rb b/test/unit/project_members_inheritance_test.rb index 849c22cb5..dde3d083c 100644 --- a/test/unit/project_members_inheritance_test.rb +++ b/test/unit/project_members_inheritance_test.rb @@ -22,6 +22,7 @@ class ProjectMembersInheritanceTest < ActiveSupport::TestCase :projects, :trackers, :issue_statuses def setup + User.current = nil @parent = Project.generate! @member = Member.create!(:principal => User.find(2), :project => @parent, :role_ids => [1, 2]) assert_equal 2, @member.reload.roles.size diff --git a/test/unit/project_nested_set_concurrency_test.rb b/test/unit/project_nested_set_concurrency_test.rb index 430aab175..771601333 100644 --- a/test/unit/project_nested_set_concurrency_test.rb +++ b/test/unit/project_nested_set_concurrency_test.rb @@ -21,6 +21,7 @@ class ProjectNestedSetConcurrencyTest < ActiveSupport::TestCase self.use_transactional_tests = false def setup + User.current = nil CustomField.delete_all end diff --git a/test/unit/project_nested_set_test.rb b/test/unit/project_nested_set_test.rb index fe31be205..1f41f745f 100644 --- a/test/unit/project_nested_set_test.rb +++ b/test/unit/project_nested_set_test.rb @@ -20,6 +20,7 @@ require File.expand_path('../../test_helper', __FILE__) class ProjectNestedSetTest < ActiveSupport::TestCase def setup + User.current = nil Project.delete_all Tracker.delete_all EnabledModule.delete_all diff --git a/test/unit/repository_bazaar_test.rb b/test/unit/repository_bazaar_test.rb index 51d18fe89..4a5efbec3 100644 --- a/test/unit/repository_bazaar_test.rb +++ b/test/unit/repository_bazaar_test.rb @@ -48,6 +48,7 @@ class RepositoryBazaarTest < ActiveSupport::TestCase CHAR_1_LATIN1_HEX = "\xdc".force_encoding('ASCII-8BIT') def setup + User.current = nil @project = Project.find(3) @repository = Repository::Bazaar.create( :project => @project, :url => REPOSITORY_PATH_TRUNK, diff --git a/test/unit/repository_cvs_test.rb b/test/unit/repository_cvs_test.rb index 2a111670f..e2f4e0429 100644 --- a/test/unit/repository_cvs_test.rb +++ b/test/unit/repository_cvs_test.rb @@ -29,6 +29,7 @@ class RepositoryCvsTest < ActiveSupport::TestCase CHANGESETS_NUM = 7 def setup + User.current = nil @project = Project.find(3) @repository = Repository::Cvs.create(:project => @project, :root_url => REPOSITORY_PATH, diff --git a/test/unit/repository_filesystem_test.rb b/test/unit/repository_filesystem_test.rb index 5adcaa0d0..be4223a6b 100644 --- a/test/unit/repository_filesystem_test.rb +++ b/test/unit/repository_filesystem_test.rb @@ -25,6 +25,7 @@ class RepositoryFilesystemTest < ActiveSupport::TestCase REPOSITORY_PATH = Rails.root.join('tmp/test/filesystem_repository').to_s def setup + User.current = nil @project = Project.find(3) Setting.enabled_scm << 'Filesystem' unless Setting.enabled_scm.include?('Filesystem') @repository = Repository::Filesystem.create( diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb index 4f223a96c..1bdab9c99 100644 --- a/test/unit/repository_git_test.rb +++ b/test/unit/repository_git_test.rb @@ -40,6 +40,7 @@ class RepositoryGitTest < ActiveSupport::TestCase JRUBY_SKIP_STR = "TODO: This test fails in JRuby" def setup + User.current = nil @project = Project.find(3) @repository = Repository::Git.create( :project => @project, diff --git a/test/unit/repository_mercurial_test.rb b/test/unit/repository_mercurial_test.rb index 1fa56c8bb..84403c844 100644 --- a/test/unit/repository_mercurial_test.rb +++ b/test/unit/repository_mercurial_test.rb @@ -29,6 +29,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase BRANCH_CHAR_1 = "branch-#{CHAR_1_HEX}-01".force_encoding('UTF-8') def setup + User.current = nil @project = Project.find(3) @repository = Repository::Mercurial.create( :project => @project, diff --git a/test/unit/repository_subversion_test.rb b/test/unit/repository_subversion_test.rb index 309554f14..a17c12bb1 100644 --- a/test/unit/repository_subversion_test.rb +++ b/test/unit/repository_subversion_test.rb @@ -25,6 +25,7 @@ class RepositorySubversionTest < ActiveSupport::TestCase NUM_REV = 11 def setup + User.current = nil @project = Project.find(3) @repository = Repository::Subversion.create(:project => @project, :url => self.class.subversion_repository_url) diff --git a/test/unit/repository_test.rb b/test/unit/repository_test.rb index 9552d0948..65295e38f 100644 --- a/test/unit/repository_test.rb +++ b/test/unit/repository_test.rb @@ -38,6 +38,7 @@ class RepositoryTest < ActiveSupport::TestCase include Redmine::I18n def setup + User.current = nil @repository = Project.find(1).repository end diff --git a/test/unit/role_test.rb b/test/unit/role_test.rb index d24010ea4..ff723a347 100644 --- a/test/unit/role_test.rb +++ b/test/unit/role_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class RoleTest < ActiveSupport::TestCase fixtures :roles, :workflows, :trackers + def setup + User.current = nil + end + def test_sorted_scope assert_equal Role.all.sort, Role.sorted.to_a end diff --git a/test/unit/search_test.rb b/test/unit/search_test.rb index a6ae15d0b..ecfbbcb9e 100644 --- a/test/unit/search_test.rb +++ b/test/unit/search_test.rb @@ -37,6 +37,7 @@ class SearchTest < ActiveSupport::TestCase :changesets def setup + User.current = nil @project = Project.find(1) @issue_keyword = '%unable to print recipes%' @issue = Issue.find(1) diff --git a/test/unit/setting_test.rb b/test/unit/setting_test.rb index b65717dbe..5eed249f1 100644 --- a/test/unit/setting_test.rb +++ b/test/unit/setting_test.rb @@ -21,6 +21,10 @@ require File.expand_path('../../test_helper', __FILE__) class SettingTest < ActiveSupport::TestCase + def setup + User.current = nil + end + def teardown Setting.delete_all Setting.clear_cache diff --git a/test/unit/time_entry_activity_test.rb b/test/unit/time_entry_activity_test.rb index 22a112fe3..14e926425 100644 --- a/test/unit/time_entry_activity_test.rb +++ b/test/unit/time_entry_activity_test.rb @@ -30,6 +30,10 @@ class TimeEntryActivityTest < ActiveSupport::TestCase include Redmine::I18n + def setup + User.current = nil + end + def test_should_be_an_enumeration assert TimeEntryActivity.ancestors.include?(Enumeration) end diff --git a/test/unit/time_entry_query_test.rb b/test/unit/time_entry_query_test.rb index 2f6891893..f5533e425 100644 --- a/test/unit/time_entry_query_test.rb +++ b/test/unit/time_entry_query_test.rb @@ -28,6 +28,10 @@ class TimeEntryQueryTest < ActiveSupport::TestCase :enabled_modules, :custom_fields, :custom_fields_trackers, :custom_fields_projects + def setup + User.current = nil + end + def test_filter_values_without_project_should_be_arrays q = TimeEntryQuery.new assert_nil q.project diff --git a/test/unit/token_test.rb b/test/unit/token_test.rb index a839a0810..2c6c865c2 100644 --- a/test/unit/token_test.rb +++ b/test/unit/token_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class TokenTest < ActiveSupport::TestCase fixtures :tokens, :users, :email_addresses + def setup + User.current = nil + end + def test_create token = Token.new token.save diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb index 1e09743c3..c1d02a56c 100644 --- a/test/unit/tracker_test.rb +++ b/test/unit/tracker_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class TrackerTest < ActiveSupport::TestCase fixtures :trackers, :workflows, :issue_statuses, :roles, :issues, :projects, :projects_trackers, :enabled_modules + def setup + User.current = nil + end + def test_sorted_scope assert_equal Tracker.all.sort, Tracker.sorted.to_a end diff --git a/test/unit/user_preference_test.rb b/test/unit/user_preference_test.rb index eb861fb89..b8765c2e2 100644 --- a/test/unit/user_preference_test.rb +++ b/test/unit/user_preference_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class UserPreferenceTest < ActiveSupport::TestCase fixtures :users, :user_preferences + def setup + User.current = nil + end + def test_hide_mail_should_default_to_true preference = UserPreference.new assert_equal true, preference.hide_mail diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb index b05096067..a55b095db 100644 --- a/test/unit/version_test.rb +++ b/test/unit/version_test.rb @@ -22,6 +22,10 @@ class VersionTest < ActiveSupport::TestCase :enumerations, :versions, :projects_trackers, :custom_fields, :custom_fields_trackers, :custom_fields_projects + def setup + User.current = nil + end + def test_create v = Version.new(:project => Project.find(1), :name => '1.1', :effective_date => '2011-03-25') diff --git a/test/unit/watcher_test.rb b/test/unit/watcher_test.rb index c1184813b..a5acbf9d1 100644 --- a/test/unit/watcher_test.rb +++ b/test/unit/watcher_test.rb @@ -25,6 +25,7 @@ class WatcherTest < ActiveSupport::TestCase :watchers def setup + User.current = nil @user = User.find(1) @issue = Issue.find(1) end diff --git a/test/unit/wiki_content_test.rb b/test/unit/wiki_content_test.rb index 1b6dcf095..016fd916a 100644 --- a/test/unit/wiki_content_test.rb +++ b/test/unit/wiki_content_test.rb @@ -24,6 +24,7 @@ class WikiContentTest < ActiveSupport::TestCase :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions def setup + User.current = nil @wiki = Wiki.find(1) @page = @wiki.pages.first end diff --git a/test/unit/wiki_content_version_test.rb b/test/unit/wiki_content_version_test.rb index 9252e3a9c..4625f708a 100644 --- a/test/unit/wiki_content_version_test.rb +++ b/test/unit/wiki_content_version_test.rb @@ -21,6 +21,7 @@ class WikiContentVersionTest < ActiveSupport::TestCase fixtures :projects, :users, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions def setup + User.current = nil end def test_should_respond_to_attachments diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb index af08815ff..3f41acff6 100644 --- a/test/unit/wiki_page_test.rb +++ b/test/unit/wiki_page_test.rb @@ -21,6 +21,7 @@ class WikiPageTest < ActiveSupport::TestCase fixtures :projects, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions def setup + User.current = nil @wiki = Wiki.find(1) @page = @wiki.pages.first end diff --git a/test/unit/wiki_redirect_test.rb b/test/unit/wiki_redirect_test.rb index 2c9e1f70c..584a671e3 100644 --- a/test/unit/wiki_redirect_test.rb +++ b/test/unit/wiki_redirect_test.rb @@ -21,6 +21,7 @@ class WikiRedirectTest < ActiveSupport::TestCase fixtures :projects, :wikis, :wiki_pages def setup + User.current = nil @wiki = Wiki.find(1) @original = WikiPage.create(:wiki => @wiki, :title => 'Original title') end diff --git a/test/unit/wiki_test.rb b/test/unit/wiki_test.rb index 47364459c..cd8f4ffd8 100644 --- a/test/unit/wiki_test.rb +++ b/test/unit/wiki_test.rb @@ -22,6 +22,10 @@ require File.expand_path('../../test_helper', __FILE__) class WikiTest < ActiveSupport::TestCase fixtures :projects, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions + def setup + User.current = nil + end + def test_create wiki = Wiki.new(:project => Project.find(3)) assert !wiki.save diff --git a/test/unit/workflow_test.rb b/test/unit/workflow_test.rb index 56d5ae622..a80288aba 100644 --- a/test/unit/workflow_test.rb +++ b/test/unit/workflow_test.rb @@ -20,6 +20,10 @@ require File.expand_path('../../test_helper', __FILE__) class WorkflowTest < ActiveSupport::TestCase fixtures :roles, :trackers, :issue_statuses + def setup + User.current = nil + end + def test_copy WorkflowTransition.delete_all WorkflowTransition.create!(:role_id => 1, :tracker_id => 2, :old_status_id => 1, :new_status_id => 2) diff --git a/test/unit/workflow_transition_test.rb b/test/unit/workflow_transition_test.rb index 1060ff484..62132c1cf 100644 --- a/test/unit/workflow_transition_test.rb +++ b/test/unit/workflow_transition_test.rb @@ -21,6 +21,7 @@ class WorkflowTransitionTest < ActiveSupport::TestCase fixtures :roles, :trackers, :issue_statuses def setup + User.current = nil WorkflowTransition.delete_all end |