]> source.dussan.org Git - redmine.git/commitdiff
Use assert_nil instead of assert_equal.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 11 Dec 2016 15:26:41 +0000 (15:26 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 11 Dec 2016 15:26:41 +0000 (15:26 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16060 e93f8b46-1217-0410-a6f0-8f06a7374b81

22 files changed:
test/functional/project_enumerations_controller_test.rb
test/functional/users_controller_test.rb
test/integration/admin_test.rb
test/integration/api_test/issues_test.rb
test/unit/auth_source_ldap_test.rb
test/unit/changeset_test.rb
test/unit/custom_field_test.rb
test/unit/custom_field_user_format_test.rb
test/unit/custom_field_version_format_test.rb
test/unit/group_test.rb
test/unit/helpers/application_helper_test.rb
test/unit/issue_test.rb
test/unit/journal_test.rb
test/unit/lib/redmine/codeset_util_test.rb
test/unit/lib/redmine/export/pdf_test.rb
test/unit/lib/redmine/menu_manager/mapper_test.rb
test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
test/unit/project_test.rb
test/unit/repository_git_test.rb
test/unit/user_test.rb
test/unit/version_test.rb
test/unit/wiki_page_test.rb

index 1ab95e4ecb1333d66f5f900b4e982d7d223b7e80..c098b2b3091641f5166350be1e6d5c8e4cae9e4a 100644 (file)
@@ -83,7 +83,7 @@ class ProjectEnumerationsControllerTest < Redmine::ControllerTest
     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
index f899e631a0f7ea533ea477780ca09593213ae252..0dbd12a811e8992b2d65a83da6bec535d1c8b990 100644 (file)
@@ -463,7 +463,7 @@ class UsersControllerTest < Redmine::ControllerTest
       :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
 
index 73f89139dc0907641bd4aa4b5e633a1bd6f47566..f16f10bd1626aa375d181cc26a5a41a0f435eb0e 100644 (file)
@@ -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
index d4040201e0328b8a299d3f5550cb7ea188536e91..94f42287a05b56530c2313653978f44588e76ec0 100644 (file)
@@ -414,8 +414,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
index bf549218b582b58480dc70cd18568ad1b693eeab..eac13ff70edc6127825cdd318295436cfa3f9c90 100644 (file)
@@ -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
index 179c515b44ab48c4690a6b3aafab381def073f4d..780bc0bd2217a28f993c467c1ee090f5b855c970 100644 (file)
@@ -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
 
index c805e170ee3d4932e8b953a352baf0dcac4285d3..461af85e4be76ff3b48a4a4aa6aca3368170a779 100644 (file)
@@ -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
index f5d4e66feb925b9175a770a2068c1e461c47a5f5..d9a1cfb2c9434426cf342ca7a71121ae8c6d8ccf 100644 (file)
@@ -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
index a394dabc84718e13c6ae464571299be69de0e810..71a835e049fcb0e1950e76ab817b8e0bb91bd7eb 100644 (file)
@@ -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
index b7302ad6885f201451ec139060c87719b8bf3ff3..4f33e5fc651ab37cebdf28f961f1e79a6b92879b 100644 (file)
@@ -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
index f1d98cbd8a7d1ca7213cf483e9a1ecb7eb5287b0..299488a2f63dede0aeb05adc267ab0b4795b06ed 100644 (file)
@@ -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 nil, to_path_param('/')
+    assert_nil to_path_param('/')
   end
 
   def test_wiki_links_in_tables
index 7adc53ec49378f3538d77e911a62f996cd7a9fb8..e4e611153a70366bc7f894b8e0d07b11d1758774 100644 (file)
@@ -1643,7 +1643,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
@@ -1665,7 +1665,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
index f26b284e72ec9e24b6150dd84104d4e757f9200b..054bdb45095cb31d85187040af3899960866e604 100644 (file)
@@ -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
index f5a6d6336589ae5a2804b5d5576baed3fb6bc532..5c88e0f759c9ea0369259cbf6aff4cfd49e9c0a9 100644 (file)
@@ -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
index d19bdeb14a8b6e2e63cc89eec2f1fac6eae6f3ce..f1f9056a37e5b297663039b0db859d7dce28fe68 100644 (file)
@@ -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
index fbffc5d124e734d0fb245b8319e1901da2f6dddb..b1a61075b4f733418236eee4c9cfee4b2d5071a8 100644 (file)
@@ -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
index 6757d5ba5aea0cb76f1e7e7e257645bb1d51bd9c..4e09b9df68084b19ddaf7bd23341e3f755e68796 100644 (file)
@@ -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
 
index b134c67ccc01136fb88f5a0ad4b8195bf8a33222..3809662f7e6c974756252051ccdfcbdde75b46eb 100644 (file)
@@ -353,8 +353,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
index 7b56b4a79368b542c70d3c97f6fdd926a49510a0..beb3d6fea2c86d8473e64ef04c5bc609eadee19f 100644 (file)
@@ -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
index d39694e949af8fbbb40f656b92f50a904c441e8b..eb9df3cef153e73415d7bbdc5fd22aa12da66fbc 100644 (file)
@@ -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
index 470207be228c3b7bfb256c09165f3e48d10fa1d9..bd0590cb5d3f72b2a1536cc30e7a8540e05089b2 100644 (file)
@@ -243,12 +243,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
index a0819e53ccfd80798af9c8113e99be787fc3cf4f..1f5e27080244cd2d7b71471ca05c93aab00f6a31 100644 (file)
@@ -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