summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-20 16:02:38 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-12-20 16:02:38 +0000
commit5dd1fe1345f43c1cd602d611c8a799f6ce59c298 (patch)
tree83a464f09554d599a624af3aa680f1fe060acf2d
parent21a847d01d9e950e5712aab04052e06275fa1baa (diff)
downloadredmine-5dd1fe1345f43c1cd602d611c8a799f6ce59c298.tar.gz
redmine-5dd1fe1345f43c1cd602d611c8a799f6ce59c298.zip
Merged r16059, r16060, r16064, r16072.
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@16106 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--test/fixtures/attachments.yml1
-rw-r--r--test/functional/issues_controller_test.rb6
-rw-r--r--test/functional/project_enumerations_controller_test.rb2
-rw-r--r--test/functional/users_controller_test.rb2
-rw-r--r--test/integration/admin_test.rb2
-rw-r--r--test/integration/api_test/issues_test.rb8
-rw-r--r--test/test_helper.rb2
-rw-r--r--test/unit/auth_source_ldap_test.rb6
-rw-r--r--test/unit/changeset_test.rb2
-rw-r--r--test/unit/custom_field_test.rb4
-rw-r--r--test/unit/custom_field_user_format_test.rb6
-rw-r--r--test/unit/custom_field_version_format_test.rb6
-rw-r--r--test/unit/group_test.rb2
-rw-r--r--test/unit/helpers/application_helper_test.rb2
-rw-r--r--test/unit/issue_test.rb4
-rw-r--r--test/unit/journal_test.rb2
-rw-r--r--test/unit/lib/redmine/codeset_util_test.rb2
-rw-r--r--test/unit/lib/redmine/export/pdf_test.rb4
-rw-r--r--test/unit/lib/redmine/i18n_test.rb7
-rw-r--r--test/unit/lib/redmine/menu_manager/mapper_test.rb2
-rw-r--r--test/unit/lib/redmine/mime_type_test.rb21
-rw-r--r--test/unit/lib/redmine/scm/adapters/git_adapter_test.rb6
-rw-r--r--test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb6
-rw-r--r--test/unit/project_test.rb4
-rw-r--r--test/unit/repository_git_test.rb2
-rw-r--r--test/unit/tracker_test.rb2
-rw-r--r--test/unit/user_test.rb6
-rw-r--r--test/unit/version_test.rb4
-rw-r--r--test/unit/wiki_page_test.rb2
29 files changed, 75 insertions, 50 deletions
diff --git a/test/fixtures/attachments.yml b/test/fixtures/attachments.yml
index 6f56c0811..f3b4545e9 100644
--- a/test/fixtures/attachments.yml
+++ b/test/fixtures/attachments.yml
@@ -12,6 +12,7 @@ attachments_001:
filesize: 28
filename: error281.txt
author_id: 2
+ description: An attachment
attachments_002:
created_on: 2007-01-27 15:08:27 +01:00
downloads: 0
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 9f34d2a53..99b3ed04e 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -4535,7 +4535,11 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal orig.project_id, copy.project_id
assert_equal orig.tracker_id, copy.tracker_id
assert_equal orig.status_id, copy.status_id
- assert_equal orig.assigned_to_id, copy.assigned_to_id
+ if orig.assigned_to_id
+ assert_equal orig.assigned_to_id, copy.assigned_to_id
+ else
+ assert_nil copy.assigned_to_id
+ end
assert_equal orig.priority_id, copy.priority_id
end
end
diff --git a/test/functional/project_enumerations_controller_test.rb b/test/functional/project_enumerations_controller_test.rb
index 336932c65..eaea523a1 100644
--- a/test/functional/project_enumerations_controller_test.rb
+++ b/test/functional/project_enumerations_controller_test.rb
@@ -83,7 +83,7 @@ class ProjectEnumerationsControllerTest < ActionController::TestCase
assert_equal "1", previously_inactive.custom_value_for(billable_field).value
# ... QA
- assert_equal nil, project.time_entry_activities.find_by_name("QA"), "Custom QA activity created when it wasn't modified"
+ assert_nil project.time_entry_activities.find_by_name("QA"), "Custom QA activity created when it wasn't modified"
end
def test_update_will_update_project_specific_activities
diff --git a/test/functional/users_controller_test.rb b/test/functional/users_controller_test.rb
index 7c22dedf2..7459753ed 100644
--- a/test/functional/users_controller_test.rb
+++ b/test/functional/users_controller_test.rb
@@ -433,7 +433,7 @@ class UsersControllerTest < ActionController::TestCase
put :update, :id => u.id, :user => {:auth_source_id => '', :password => 'newpass123', :password_confirmation => 'newpass123'}
- assert_equal nil, u.reload.auth_source
+ assert_nil u.reload.auth_source
assert u.check_password?('newpass123')
end
diff --git a/test/integration/admin_test.rb b/test/integration/admin_test.rb
index 22a675a71..1884645ab 100644
--- a/test/integration/admin_test.rb
+++ b/test/integration/admin_test.rb
@@ -48,7 +48,7 @@ class AdminTest < Redmine::IntegrationTest
put "/users/#{user.id}", :id => user.id, :user => { :status => User::STATUS_LOCKED }
assert_redirected_to "/users/#{ user.id }/edit"
locked_user = User.try_to_login("psmith", "psmith09")
- assert_equal nil, locked_user
+ assert_nil locked_user
end
test "Add a user as an anonymous user should fail" do
diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb
index c21d2ccb9..4bdfff1bc 100644
--- a/test/integration/api_test/issues_test.rb
+++ b/test/integration/api_test/issues_test.rb
@@ -359,6 +359,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
test "GET /issues/:id.xml should contains total_estimated_hours and total_spent_hours" do
parent = Issue.find(3)
+ parent.update_columns :estimated_hours => 2.0
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
:hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
@@ -375,6 +376,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
test "GET /issues/:id.xml should contains total_estimated_hours, and should not contains spent_hours and total_spent_hours when permission does not exists" do
parent = Issue.find(3)
+ parent.update_columns :estimated_hours => 2.0
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
# remove permission!
Role.anonymous.remove_permission! :view_time_entries
@@ -392,6 +394,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
test "GET /issues/:id.json should contains total_estimated_hours and total_spent_hours" do
parent = Issue.find(3)
+ parent.update_columns :estimated_hours => 2.0
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
:hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
@@ -407,6 +410,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
test "GET /issues/:id.json should contains total_estimated_hours, and should not contains spent_hours and total_spent_hours when permission does not exists" do
parent = Issue.find(3)
+ parent.update_columns :estimated_hours => 2.0
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
# remove permission!
Role.anonymous.remove_permission! :view_time_entries
@@ -417,8 +421,8 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
json = ActiveSupport::JSON.decode(response.body)
assert_equal parent.estimated_hours, json['issue']['estimated_hours']
assert_equal (parent.estimated_hours.to_f + 3.0), json['issue']['total_estimated_hours']
- assert_equal nil, json['issue']['spent_hours']
- assert_equal nil, json['issue']['total_spent_hours']
+ assert_nil json['issue']['spent_hours']
+ assert_nil json['issue']['total_spent_hours']
end
test "POST /issues.xml should create an issue with the attributes" do
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 7f4d2cdb0..7021332ee 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -281,7 +281,7 @@ module Redmine
def log_user(login, password)
User.anonymous
get "/login"
- assert_equal nil, session[:user_id]
+ assert_nil session[:user_id]
assert_response :success
assert_template "account/login"
post "/login", :username => login, :password => password
diff --git a/test/unit/auth_source_ldap_test.rb b/test/unit/auth_source_ldap_test.rb
index bf549218b..eac13ff70 100644
--- a/test/unit/auth_source_ldap_test.rb
+++ b/test/unit/auth_source_ldap_test.rb
@@ -95,17 +95,17 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
test '#authenticate with an invalid LDAP user should return nil' do
auth = AuthSourceLdap.find(1)
- assert_equal nil, auth.authenticate('nouser','123456')
+ assert_nil auth.authenticate('nouser','123456')
end
test '#authenticate without a login should return nil' do
auth = AuthSourceLdap.find(1)
- assert_equal nil, auth.authenticate('','123456')
+ assert_nil auth.authenticate('','123456')
end
test '#authenticate without a password should return nil' do
auth = AuthSourceLdap.find(1)
- assert_equal nil, auth.authenticate('edavis','')
+ assert_nil auth.authenticate('edavis','')
end
test '#authenticate without filter should return any user' do
diff --git a/test/unit/changeset_test.rb b/test/unit/changeset_test.rb
index 179c515b4..780bc0bd2 100644
--- a/test/unit/changeset_test.rb
+++ b/test/unit/changeset_test.rb
@@ -566,7 +566,7 @@ class ChangesetTest < ActiveSupport::TestCase
:committer => nil)
assert( c.save )
assert_equal "", c.comments
- assert_equal nil, c.committer
+ assert_nil c.committer
assert_equal "UTF-8", c.comments.encoding.to_s
end
diff --git a/test/unit/custom_field_test.rb b/test/unit/custom_field_test.rb
index c805e170e..461af85e4 100644
--- a/test/unit/custom_field_test.rb
+++ b/test/unit/custom_field_test.rb
@@ -321,8 +321,8 @@ class CustomFieldTest < ActiveSupport::TestCase
def test_float_cast_blank_value_should_return_nil
field = CustomField.new(:field_format => 'float')
- assert_equal nil, field.cast_value(nil)
- assert_equal nil, field.cast_value('')
+ assert_nil field.cast_value(nil)
+ assert_nil field.cast_value('')
end
def test_float_cast_valid_value_should_return_float
diff --git a/test/unit/custom_field_user_format_test.rb b/test/unit/custom_field_user_format_test.rb
index f5d4e66fe..d9a1cfb2c 100644
--- a/test/unit/custom_field_user_format_test.rb
+++ b/test/unit/custom_field_user_format_test.rb
@@ -62,8 +62,8 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase
end
def test_cast_blank_value
- assert_equal nil, @field.cast_value(nil)
- assert_equal nil, @field.cast_value("")
+ assert_nil @field.cast_value(nil)
+ assert_nil @field.cast_value("")
end
def test_cast_valid_value
@@ -73,6 +73,6 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase
end
def test_cast_invalid_value
- assert_equal nil, @field.cast_value("187")
+ assert_nil @field.cast_value("187")
end
end
diff --git a/test/unit/custom_field_version_format_test.rb b/test/unit/custom_field_version_format_test.rb
index a394dabc8..71a835e04 100644
--- a/test/unit/custom_field_version_format_test.rb
+++ b/test/unit/custom_field_version_format_test.rb
@@ -45,8 +45,8 @@ class CustomFieldVersionFormatTest < ActiveSupport::TestCase
end
def test_cast_blank_value
- assert_equal nil, @field.cast_value(nil)
- assert_equal nil, @field.cast_value("")
+ assert_nil @field.cast_value(nil)
+ assert_nil @field.cast_value("")
end
def test_cast_valid_value
@@ -56,6 +56,6 @@ class CustomFieldVersionFormatTest < ActiveSupport::TestCase
end
def test_cast_invalid_value
- assert_equal nil, @field.cast_value("187")
+ assert_nil @field.cast_value("187")
end
end
diff --git a/test/unit/group_test.rb b/test/unit/group_test.rb
index b7302ad68..4f33e5fc6 100644
--- a/test/unit/group_test.rb
+++ b/test/unit/group_test.rb
@@ -130,7 +130,7 @@ class GroupTest < ActiveSupport::TestCase
assert group.destroy
assert group.destroyed?
- assert_equal nil, Issue.find(1).assigned_to_id
+ assert_nil Issue.find(1).assigned_to_id
end
def test_builtin_groups_should_be_created_if_missing
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index 89af800be..dca614d77 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -1019,7 +1019,7 @@ EXPECTED
assert_equal 'test1/test2', to_path_param('test1/test2')
assert_equal 'test1/test2', to_path_param('/test1/test2/')
assert_equal 'test1/test2', to_path_param('//test1/test2/')
- assert_equal nil, to_path_param('/')
+ assert_nil to_path_param('/')
end
def test_wiki_links_in_tables
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index f41368a48..b97703244 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -1664,7 +1664,7 @@ class IssueTest < ActiveSupport::TestCase
issue.reload
assert_equal 2, issue.project_id
# Cleared fixed_version
- assert_equal nil, issue.fixed_version
+ assert_nil issue.fixed_version
end
def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project
@@ -1686,7 +1686,7 @@ class IssueTest < ActiveSupport::TestCase
issue.reload
assert_equal 5, issue.project_id
# Cleared fixed_version
- assert_equal nil, issue.fixed_version
+ assert_nil issue.fixed_version
end
def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide
diff --git a/test/unit/journal_test.rb b/test/unit/journal_test.rb
index f26b284e7..054bdb450 100644
--- a/test/unit/journal_test.rb
+++ b/test/unit/journal_test.rb
@@ -201,7 +201,7 @@ class JournalTest < ActiveSupport::TestCase
def test_custom_field_should_return_nil_for_non_cf_detail
d = JournalDetail.new(:property => 'subject')
- assert_equal nil, d.custom_field
+ assert_nil d.custom_field
end
def test_visible_details_should_include_relations_to_visible_issues_only
diff --git a/test/unit/lib/redmine/codeset_util_test.rb b/test/unit/lib/redmine/codeset_util_test.rb
index f5a6d6336..5c88e0f75 100644
--- a/test/unit/lib/redmine/codeset_util_test.rb
+++ b/test/unit/lib/redmine/codeset_util_test.rb
@@ -51,7 +51,7 @@ class Redmine::CodesetUtilTest < ActiveSupport::TestCase
def test_to_utf8_by_setting_blank_string
assert_equal "", Redmine::CodesetUtil.to_utf8_by_setting("")
- assert_equal nil, Redmine::CodesetUtil.to_utf8_by_setting(nil)
+ assert_nil Redmine::CodesetUtil.to_utf8_by_setting(nil)
end
def test_to_utf8_by_setting_returns_ascii_as_utf8
diff --git a/test/unit/lib/redmine/export/pdf_test.rb b/test/unit/lib/redmine/export/pdf_test.rb
index d19bdeb14..f1f9056a3 100644
--- a/test/unit/lib/redmine/export/pdf_test.rb
+++ b/test/unit/lib/redmine/export/pdf_test.rb
@@ -94,9 +94,9 @@ class PdfTest < ActiveSupport::TestCase
assert a2.readable?
assert (! a2.visible?)
aa1 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "Testfile.PNG", "UTF-8")
- assert_equal nil, aa1
+ assert_nil aa1
aa2 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "test#{str2}.png", encoding)
- assert_equal nil, aa2
+ assert_nil aa2
set_tmp_attachments_directory
end
diff --git a/test/unit/lib/redmine/i18n_test.rb b/test/unit/lib/redmine/i18n_test.rb
index 1b2ad78f9..ad11e7d35 100644
--- a/test/unit/lib/redmine/i18n_test.rb
+++ b/test/unit/lib/redmine/i18n_test.rb
@@ -217,11 +217,14 @@ class Redmine::I18nTest < ActiveSupport::TestCase
'Fr' => :fr,
'zh' => :zh,
'zh-tw' => :"zh-TW",
- 'zh-TW' => :"zh-TW",
- 'zh-ZZ' => nil }
+ 'zh-TW' => :"zh-TW"}
to_test.each {|lang, expected| assert_equal expected, find_language(lang)}
end
+ def test_find_language_with_invalid_language_should_return_nil
+ assert_nil find_language('zh-ZZ')
+ end
+
def test_fallback
::I18n.backend.store_translations(:en, {:untranslated => "Untranslated string"})
::I18n.locale = 'en'
diff --git a/test/unit/lib/redmine/menu_manager/mapper_test.rb b/test/unit/lib/redmine/menu_manager/mapper_test.rb
index fbffc5d12..b1a61075b 100644
--- a/test/unit/lib/redmine/menu_manager/mapper_test.rb
+++ b/test/unit/lib/redmine/menu_manager/mapper_test.rb
@@ -156,7 +156,7 @@ class Redmine::MenuManager::MapperTest < ActiveSupport::TestCase
menu_mapper.push :test_overview, { :controller => 'projects', :action => 'show'}, {}
item = menu_mapper.find(:nothing)
- assert_equal nil, item
+ assert_nil item
end
def test_delete
diff --git a/test/unit/lib/redmine/mime_type_test.rb b/test/unit/lib/redmine/mime_type_test.rb
index 3e3d6c626..999b224b5 100644
--- a/test/unit/lib/redmine/mime_type_test.rb
+++ b/test/unit/lib/redmine/mime_type_test.rb
@@ -20,8 +20,7 @@ require File.expand_path('../../../../test_helper', __FILE__)
class Redmine::MimeTypeTest < ActiveSupport::TestCase
def test_of
- to_test = {'test.unk' => nil,
- 'test.txt' => 'text/plain',
+ to_test = {'test.txt' => 'text/plain',
'test.c' => 'text/x-c',
}
to_test.each do |name, expected|
@@ -29,9 +28,12 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
end
end
+ def test_of_with_unknown_type
+ assert_nil Redmine::MimeType.of('test.unk')
+ end
+
def test_css_class_of
- to_test = {'test.unk' => nil,
- 'test.txt' => 'text-plain',
+ to_test = {'test.txt' => 'text-plain',
'test.c' => 'text-x-c',
}
to_test.each do |name, expected|
@@ -39,9 +41,12 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
end
end
+ def test_css_class_of_with_unknown_type
+ assert_nil Redmine::MimeType.css_class_of('test.unk')
+ end
+
def test_main_mimetype_of
- to_test = {'test.unk' => nil,
- 'test.txt' => 'text',
+ to_test = {'test.txt' => 'text',
'test.c' => 'text',
}
to_test.each do |name, expected|
@@ -49,6 +54,10 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
end
end
+ def test_main_mimetype_of_with_unknown_type
+ assert_nil Redmine::MimeType.main_mimetype_of('test.unk')
+ end
+
def test_is_type
to_test = {['text', 'test.unk'] => false,
['text', 'test.txt'] => true,
diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
index 6757d5ba5..4e09b9df6 100644
--- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
+++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
@@ -336,7 +336,7 @@ class GitAdapterTest < ActiveSupport::TestCase
assert_equal 15, revs1.length
assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518",
revs1[0].identifier
- assert_equal nil, revs1[0].parents
+ assert_nil revs1[0].parents
assert_equal "899a15dba03a3b350b89c3f537e4bbe02a03cdc9",
revs1[1].identifier
assert_equal 1, revs1[1].parents.length
@@ -477,8 +477,8 @@ class GitAdapterTest < ActiveSupport::TestCase
assert entries1
assert_equal 3, entries1.size
f1 = entries1[1]
- assert_equal nil, f1.name
- assert_equal nil, f1.path
+ assert_nil f1.name
+ assert_nil f1.path
assert_equal 'file', f1.kind
end
diff --git a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
index b093e3109..e3c04f025 100644
--- a/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
+++ b/test/unit/lib/redmine/scm/adapters/mercurial_adapter_test.rb
@@ -447,7 +447,11 @@ class MercurialAdapterTest < ActiveSupport::TestCase
def test_hgversion_for(hgversion, version)
@adapter.class.expects(:hgversion_from_command_line).returns(hgversion)
- assert_equal version, @adapter.class.hgversion
+ if version
+ assert_equal version, @adapter.class.hgversion
+ else
+ assert_nil @adapter.class.hgversion
+ end
end
def test_template_path_for(version, template)
diff --git a/test/unit/project_test.rb b/test/unit/project_test.rb
index a3f2b7d45..837d2a521 100644
--- a/test/unit/project_test.rb
+++ b/test/unit/project_test.rb
@@ -365,8 +365,8 @@ class ProjectTest < ActiveSupport::TestCase
issue_with_hierarchy_fixed_version.reload
assert_equal 4, issue_with_local_fixed_version.fixed_version_id, "Fixed version was not keep on an issue local to the moved project"
- assert_equal nil, issue_with_hierarchy_fixed_version.fixed_version_id, "Fixed version is still set after moving the Project out of the hierarchy where the version is defined in"
- assert_equal nil, parent_issue.fixed_version_id, "Fixed version is still set after moving the Version out of the hierarchy for the issue."
+ assert_nil issue_with_hierarchy_fixed_version.fixed_version_id, "Fixed version is still set after moving the Project out of the hierarchy where the version is defined in"
+ assert_nil parent_issue.fixed_version_id, "Fixed version is still set after moving the Version out of the hierarchy for the issue."
end
def test_parent
diff --git a/test/unit/repository_git_test.rb b/test/unit/repository_git_test.rb
index 15b7ea53b..c78d7cd05 100644
--- a/test/unit/repository_git_test.rb
+++ b/test/unit/repository_git_test.rb
@@ -149,7 +149,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
assert_equal 3, commit.filechanges.count
change = commit.filechanges.sort_by(&:path).first
assert_equal "README", change.path
- assert_equal nil, change.from_path
+ assert_nil change.from_path
assert_equal "A", change.action
assert_equal NUM_HEAD, @repository.extra_info["heads"].size
diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb
index d45291fd7..a03fa26be 100644
--- a/test/unit/tracker_test.rb
+++ b/test/unit/tracker_test.rb
@@ -25,7 +25,7 @@ class TrackerTest < ActiveSupport::TestCase
end
def test_named_scope
- assert_equal Tracker.find_by_name('Feature'), Tracker.named('feature').first
+ assert_equal Tracker.find(2), Tracker.named('feature request').first
end
def test_visible_scope_chained_with_project_rolled_up_trackers
diff --git a/test/unit/user_test.rb b/test/unit/user_test.rb
index ef23e397c..82613dd23 100644
--- a/test/unit/user_test.rb
+++ b/test/unit/user_test.rb
@@ -611,7 +611,7 @@ class UserTest < ActiveSupport::TestCase
@jsmith.save!
user = User.try_to_login("jsmith", "jsmith")
- assert_equal nil, user
+ assert_nil user
end
def test_try_to_login_with_locked_user_and_not_active_only_should_return_user
@@ -645,11 +645,11 @@ class UserTest < ActiveSupport::TestCase
auth_source = AuthSourceLdap.find(1)
AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect')
- assert_equal nil, User.try_to_login('edavis', 'wrong')
+ assert_nil User.try_to_login('edavis', 'wrong')
end
test "#try_to_login using LDAP" do
- assert_equal nil, User.try_to_login('edavis', 'wrong')
+ assert_nil User.try_to_login('edavis', 'wrong')
end
test "#try_to_login using LDAP binding with user's account" do
diff --git a/test/unit/version_test.rb b/test/unit/version_test.rb
index 56adc3c4a..28049734e 100644
--- a/test/unit/version_test.rb
+++ b/test/unit/version_test.rb
@@ -227,12 +227,12 @@ class VersionTest < ActiveSupport::TestCase
# Project 1 now out of the shared scope
project_1_issue.reload
- assert_equal nil, project_1_issue.fixed_version,
+ assert_nil project_1_issue.fixed_version,
"Fixed version is still set after changing the Version's sharing"
# Project 5 now out of the shared scope
project_5_issue.reload
- assert_equal nil, project_5_issue.fixed_version,
+ assert_nil project_5_issue.fixed_version,
"Fixed version is still set after changing the Version's sharing"
# Project 2 issue remains
diff --git a/test/unit/wiki_page_test.rb b/test/unit/wiki_page_test.rb
index a0819e53c..1f5e27080 100644
--- a/test/unit/wiki_page_test.rb
+++ b/test/unit/wiki_page_test.rb
@@ -107,7 +107,7 @@ class WikiPageTest < ActiveSupport::TestCase
child.wiki_id = 2
child.save!
- assert_equal nil, child.reload.parent_id
+ assert_nil child.reload.parent_id
end
def test_move_parent_should_move_child_page