Commit 4c4fc143 authored by jplang's avatar jplang

Use assert_nil instead of assert_equal.

git-svn-id: https://svn.redmine.org/redmine/trunk@16060 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent fde3836d
...@@ -83,7 +83,7 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest ...@@ -83,7 +83,7 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
assert_equal "1", previously_inactive.custom_value_for(billable_field).value assert_equal "1", previously_inactive.custom_value_for(billable_field).value
# ... QA # ... 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 end
def test_update_will_update_project_specific_activities def test_update_will_update_project_specific_activities
......
...@@ -463,7 +463,7 @@ class UsersControllerTest < Redmine::ControllerTest ...@@ -463,7 +463,7 @@ class UsersControllerTest < Redmine::ControllerTest
:user => {:auth_source_id => '', :password => 'newpass123', :password_confirmation => 'newpass123'} :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') assert u.check_password?('newpass123')
end end
......
...@@ -48,7 +48,7 @@ class AdminTest < Redmine::IntegrationTest ...@@ -48,7 +48,7 @@ class AdminTest < Redmine::IntegrationTest
put "/users/#{user.id}", :id => user.id, :user => { :status => User::STATUS_LOCKED } put "/users/#{user.id}", :id => user.id, :user => { :status => User::STATUS_LOCKED }
assert_redirected_to "/users/#{ user.id }/edit" assert_redirected_to "/users/#{ user.id }/edit"
locked_user = User.try_to_login("psmith", "psmith09") locked_user = User.try_to_login("psmith", "psmith09")
assert_equal nil, locked_user assert_nil locked_user
end end
test "Add a user as an anonymous user should fail" do test "Add a user as an anonymous user should fail" do
......
...@@ -414,8 +414,8 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base ...@@ -414,8 +414,8 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
json = ActiveSupport::JSON.decode(response.body) json = ActiveSupport::JSON.decode(response.body)
assert_equal parent.estimated_hours, json['issue']['estimated_hours'] 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 (parent.estimated_hours.to_f + 3.0), json['issue']['total_estimated_hours']
assert_equal nil, json['issue']['spent_hours'] assert_nil json['issue']['spent_hours']
assert_equal nil, json['issue']['total_spent_hours'] assert_nil json['issue']['total_spent_hours']
end end
test "POST /issues.xml should create an issue with the attributes" do test "POST /issues.xml should create an issue with the attributes" do
......
...@@ -95,17 +95,17 @@ class AuthSourceLdapTest < ActiveSupport::TestCase ...@@ -95,17 +95,17 @@ class AuthSourceLdapTest < ActiveSupport::TestCase
test '#authenticate with an invalid LDAP user should return nil' do test '#authenticate with an invalid LDAP user should return nil' do
auth = AuthSourceLdap.find(1) auth = AuthSourceLdap.find(1)
assert_equal nil, auth.authenticate('nouser','123456') assert_nil auth.authenticate('nouser','123456')
end end
test '#authenticate without a login should return nil' do test '#authenticate without a login should return nil' do
auth = AuthSourceLdap.find(1) auth = AuthSourceLdap.find(1)
assert_equal nil, auth.authenticate('','123456') assert_nil auth.authenticate('','123456')
end end
test '#authenticate without a password should return nil' do test '#authenticate without a password should return nil' do
auth = AuthSourceLdap.find(1) auth = AuthSourceLdap.find(1)
assert_equal nil, auth.authenticate('edavis','') assert_nil auth.authenticate('edavis','')
end end
test '#authenticate without filter should return any user' do test '#authenticate without filter should return any user' do
......
...@@ -566,7 +566,7 @@ class ChangesetTest < ActiveSupport::TestCase ...@@ -566,7 +566,7 @@ class ChangesetTest < ActiveSupport::TestCase
:committer => nil) :committer => nil)
assert( c.save ) assert( c.save )
assert_equal "", c.comments assert_equal "", c.comments
assert_equal nil, c.committer assert_nil c.committer
assert_equal "UTF-8", c.comments.encoding.to_s assert_equal "UTF-8", c.comments.encoding.to_s
end end
......
...@@ -321,8 +321,8 @@ class CustomFieldTest < ActiveSupport::TestCase ...@@ -321,8 +321,8 @@ class CustomFieldTest < ActiveSupport::TestCase
def test_float_cast_blank_value_should_return_nil def test_float_cast_blank_value_should_return_nil
field = CustomField.new(:field_format => 'float') field = CustomField.new(:field_format => 'float')
assert_equal nil, field.cast_value(nil) assert_nil field.cast_value(nil)
assert_equal nil, field.cast_value('') assert_nil field.cast_value('')
end end
def test_float_cast_valid_value_should_return_float def test_float_cast_valid_value_should_return_float
......
...@@ -62,8 +62,8 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase ...@@ -62,8 +62,8 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase
end end
def test_cast_blank_value def test_cast_blank_value
assert_equal nil, @field.cast_value(nil) assert_nil @field.cast_value(nil)
assert_equal nil, @field.cast_value("") assert_nil @field.cast_value("")
end end
def test_cast_valid_value def test_cast_valid_value
...@@ -73,6 +73,6 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase ...@@ -73,6 +73,6 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase
end end
def test_cast_invalid_value def test_cast_invalid_value
assert_equal nil, @field.cast_value("187") assert_nil @field.cast_value("187")
end end
end end
...@@ -45,8 +45,8 @@ class CustomFieldVersionFormatTest < ActiveSupport::TestCase ...@@ -45,8 +45,8 @@ class CustomFieldVersionFormatTest < ActiveSupport::TestCase
end end
def test_cast_blank_value def test_cast_blank_value
assert_equal nil, @field.cast_value(nil) assert_nil @field.cast_value(nil)
assert_equal nil, @field.cast_value("") assert_nil @field.cast_value("")
end end
def test_cast_valid_value def test_cast_valid_value
...@@ -56,6 +56,6 @@ class CustomFieldVersionFormatTest < ActiveSupport::TestCase ...@@ -56,6 +56,6 @@ class CustomFieldVersionFormatTest < ActiveSupport::TestCase
end end
def test_cast_invalid_value def test_cast_invalid_value
assert_equal nil, @field.cast_value("187") assert_nil @field.cast_value("187")
end end
end end
...@@ -130,7 +130,7 @@ class GroupTest < ActiveSupport::TestCase ...@@ -130,7 +130,7 @@ class GroupTest < ActiveSupport::TestCase
assert group.destroy assert group.destroy
assert group.destroyed? assert group.destroyed?
assert_equal nil, Issue.find(1).assigned_to_id assert_nil Issue.find(1).assigned_to_id
end end
def test_builtin_groups_should_be_created_if_missing def test_builtin_groups_should_be_created_if_missing
......
...@@ -1020,7 +1020,7 @@ EXPECTED ...@@ -1020,7 +1020,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 '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 end
def test_wiki_links_in_tables def test_wiki_links_in_tables
......
...@@ -1643,7 +1643,7 @@ class IssueTest < ActiveSupport::TestCase ...@@ -1643,7 +1643,7 @@ class IssueTest < ActiveSupport::TestCase
issue.reload issue.reload
assert_equal 2, issue.project_id assert_equal 2, issue.project_id
# Cleared fixed_version # Cleared fixed_version
assert_equal nil, issue.fixed_version assert_nil issue.fixed_version
end end
def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project def test_move_to_another_project_should_keep_fixed_version_when_shared_with_the_target_project
...@@ -1665,7 +1665,7 @@ class IssueTest < ActiveSupport::TestCase ...@@ -1665,7 +1665,7 @@ class IssueTest < ActiveSupport::TestCase
issue.reload issue.reload
assert_equal 5, issue.project_id assert_equal 5, issue.project_id
# Cleared fixed_version # Cleared fixed_version
assert_equal nil, issue.fixed_version assert_nil issue.fixed_version
end end
def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide
......
...@@ -201,7 +201,7 @@ class JournalTest < ActiveSupport::TestCase ...@@ -201,7 +201,7 @@ class JournalTest < ActiveSupport::TestCase
def test_custom_field_should_return_nil_for_non_cf_detail def test_custom_field_should_return_nil_for_non_cf_detail
d = JournalDetail.new(:property => 'subject') d = JournalDetail.new(:property => 'subject')
assert_equal nil, d.custom_field assert_nil d.custom_field
end end
def test_visible_details_should_include_relations_to_visible_issues_only def test_visible_details_should_include_relations_to_visible_issues_only
......
...@@ -51,7 +51,7 @@ class Redmine::CodesetUtilTest < ActiveSupport::TestCase ...@@ -51,7 +51,7 @@ class Redmine::CodesetUtilTest < ActiveSupport::TestCase
def test_to_utf8_by_setting_blank_string def test_to_utf8_by_setting_blank_string
assert_equal "", Redmine::CodesetUtil.to_utf8_by_setting("") 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 end
def test_to_utf8_by_setting_returns_ascii_as_utf8 def test_to_utf8_by_setting_returns_ascii_as_utf8
......
...@@ -94,9 +94,9 @@ class PdfTest < ActiveSupport::TestCase ...@@ -94,9 +94,9 @@ class PdfTest < ActiveSupport::TestCase
assert a2.readable? assert a2.readable?
assert (! a2.visible?) assert (! a2.visible?)
aa1 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "Testfile.PNG", "UTF-8") 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) aa2 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "test#{str2}.png", encoding)
assert_equal nil, aa2 assert_nil aa2
set_tmp_attachments_directory set_tmp_attachments_directory
end end
......
...@@ -156,7 +156,7 @@ class Redmine::MenuManager::MapperTest < ActiveSupport::TestCase ...@@ -156,7 +156,7 @@ class Redmine::MenuManager::MapperTest < ActiveSupport::TestCase
menu_mapper.push :test_overview, { :controller => 'projects', :action => 'show'}, {} menu_mapper.push :test_overview, { :controller => 'projects', :action => 'show'}, {}
item = menu_mapper.find(:nothing) item = menu_mapper.find(:nothing)
assert_equal nil, item assert_nil item
end end
def test_delete def test_delete
......
...@@ -336,7 +336,7 @@ class GitAdapterTest < ActiveSupport::TestCase ...@@ -336,7 +336,7 @@ class GitAdapterTest < ActiveSupport::TestCase
assert_equal 15, revs1.length assert_equal 15, revs1.length
assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518", assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518",
revs1[0].identifier revs1[0].identifier
assert_equal nil, revs1[0].parents assert_nil revs1[0].parents
assert_equal "899a15dba03a3b350b89c3f537e4bbe02a03cdc9", assert_equal "899a15dba03a3b350b89c3f537e4bbe02a03cdc9",
revs1[1].identifier revs1[1].identifier
assert_equal 1, revs1[1].parents.length assert_equal 1, revs1[1].parents.length
...@@ -477,8 +477,8 @@ class GitAdapterTest < ActiveSupport::TestCase ...@@ -477,8 +477,8 @@ class GitAdapterTest < ActiveSupport::TestCase
assert entries1 assert entries1
assert_equal 3, entries1.size assert_equal 3, entries1.size
f1 = entries1[1] f1 = entries1[1]
assert_equal nil, f1.name assert_nil f1.name
assert_equal nil, f1.path assert_nil f1.path
assert_equal 'file', f1.kind assert_equal 'file', f1.kind
end end
......
...@@ -353,8 +353,8 @@ class ProjectTest < ActiveSupport::TestCase ...@@ -353,8 +353,8 @@ class ProjectTest < ActiveSupport::TestCase
issue_with_hierarchy_fixed_version.reload 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 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_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 parent_issue.fixed_version_id, "Fixed version is still set after moving the Version out of the hierarchy for the issue."
end end
def test_parent def test_parent
......
...@@ -149,7 +149,7 @@ class RepositoryGitTest < ActiveSupport::TestCase ...@@ -149,7 +149,7 @@ class RepositoryGitTest < ActiveSupport::TestCase
assert_equal 3, commit.filechanges.count assert_equal 3, commit.filechanges.count
change = commit.filechanges.sort_by(&:path).first change = commit.filechanges.sort_by(&:path).first
assert_equal "README", change.path assert_equal "README", change.path
assert_equal nil, change.from_path assert_nil change.from_path
assert_equal "A", change.action assert_equal "A", change.action
assert_equal NUM_HEAD, @repository.extra_info["heads"].size assert_equal NUM_HEAD, @repository.extra_info["heads"].size
......
...@@ -611,7 +611,7 @@ class UserTest < ActiveSupport::TestCase ...@@ -611,7 +611,7 @@ class UserTest < ActiveSupport::TestCase
@jsmith.save! @jsmith.save!
user = User.try_to_login("jsmith", "jsmith") user = User.try_to_login("jsmith", "jsmith")
assert_equal nil, user assert_nil user
end end
def test_try_to_login_with_locked_user_and_not_active_only_should_return_user def test_try_to_login_with_locked_user_and_not_active_only_should_return_user
...@@ -645,11 +645,11 @@ class UserTest < ActiveSupport::TestCase ...@@ -645,11 +645,11 @@ class UserTest < ActiveSupport::TestCase
auth_source = AuthSourceLdap.find(1) auth_source = AuthSourceLdap.find(1)
AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect') 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 end
test "#try_to_login using LDAP" do 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 end
test "#try_to_login using LDAP binding with user's account" do test "#try_to_login using LDAP binding with user's account" do
......
...@@ -243,12 +243,12 @@ class VersionTest < ActiveSupport::TestCase ...@@ -243,12 +243,12 @@ class VersionTest < ActiveSupport::TestCase
# Project 1 now out of the shared scope # Project 1 now out of the shared scope
project_1_issue.reload 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" "Fixed version is still set after changing the Version's sharing"
# Project 5 now out of the shared scope # Project 5 now out of the shared scope
project_5_issue.reload 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" "Fixed version is still set after changing the Version's sharing"
# Project 2 issue remains # Project 2 issue remains
......
...@@ -107,7 +107,7 @@ class WikiPageTest < ActiveSupport::TestCase ...@@ -107,7 +107,7 @@ class WikiPageTest < ActiveSupport::TestCase
child.wiki_id = 2 child.wiki_id = 2
child.save! child.save!
assert_equal nil, child.reload.parent_id assert_nil child.reload.parent_id
end end
def test_move_parent_should_move_child_page def test_move_parent_should_move_child_page
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment