##// END OF EJS Templates
Use assert_nil instead of assert_equal....
Jean-Philippe Lang -
r15678:bf5dade8df89
parent child
Show More
@@ -83,7 +83,7 class ProjectEnumerationsControllerTest < Redmine::ControllerTest
83 83 assert_equal "1", previously_inactive.custom_value_for(billable_field).value
84 84
85 85 # ... QA
86 assert_equal nil, project.time_entry_activities.find_by_name("QA"), "Custom QA activity created when it wasn't modified"
86 assert_nil project.time_entry_activities.find_by_name("QA"), "Custom QA activity created when it wasn't modified"
87 87 end
88 88
89 89 def test_update_will_update_project_specific_activities
@@ -463,7 +463,7 class UsersControllerTest < Redmine::ControllerTest
463 463 :user => {:auth_source_id => '', :password => 'newpass123', :password_confirmation => 'newpass123'}
464 464 }
465 465
466 assert_equal nil, u.reload.auth_source
466 assert_nil u.reload.auth_source
467 467 assert u.check_password?('newpass123')
468 468 end
469 469
@@ -48,7 +48,7 class AdminTest < Redmine::IntegrationTest
48 48 put "/users/#{user.id}", :id => user.id, :user => { :status => User::STATUS_LOCKED }
49 49 assert_redirected_to "/users/#{ user.id }/edit"
50 50 locked_user = User.try_to_login("psmith", "psmith09")
51 assert_equal nil, locked_user
51 assert_nil locked_user
52 52 end
53 53
54 54 test "Add a user as an anonymous user should fail" do
@@ -414,8 +414,8 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
414 414 json = ActiveSupport::JSON.decode(response.body)
415 415 assert_equal parent.estimated_hours, json['issue']['estimated_hours']
416 416 assert_equal (parent.estimated_hours.to_f + 3.0), json['issue']['total_estimated_hours']
417 assert_equal nil, json['issue']['spent_hours']
418 assert_equal nil, json['issue']['total_spent_hours']
417 assert_nil json['issue']['spent_hours']
418 assert_nil json['issue']['total_spent_hours']
419 419 end
420 420
421 421 test "POST /issues.xml should create an issue with the attributes" do
@@ -95,17 +95,17 class AuthSourceLdapTest < ActiveSupport::TestCase
95 95
96 96 test '#authenticate with an invalid LDAP user should return nil' do
97 97 auth = AuthSourceLdap.find(1)
98 assert_equal nil, auth.authenticate('nouser','123456')
98 assert_nil auth.authenticate('nouser','123456')
99 99 end
100 100
101 101 test '#authenticate without a login should return nil' do
102 102 auth = AuthSourceLdap.find(1)
103 assert_equal nil, auth.authenticate('','123456')
103 assert_nil auth.authenticate('','123456')
104 104 end
105 105
106 106 test '#authenticate without a password should return nil' do
107 107 auth = AuthSourceLdap.find(1)
108 assert_equal nil, auth.authenticate('edavis','')
108 assert_nil auth.authenticate('edavis','')
109 109 end
110 110
111 111 test '#authenticate without filter should return any user' do
@@ -566,7 +566,7 class ChangesetTest < ActiveSupport::TestCase
566 566 :committer => nil)
567 567 assert( c.save )
568 568 assert_equal "", c.comments
569 assert_equal nil, c.committer
569 assert_nil c.committer
570 570 assert_equal "UTF-8", c.comments.encoding.to_s
571 571 end
572 572
@@ -321,8 +321,8 class CustomFieldTest < ActiveSupport::TestCase
321 321
322 322 def test_float_cast_blank_value_should_return_nil
323 323 field = CustomField.new(:field_format => 'float')
324 assert_equal nil, field.cast_value(nil)
325 assert_equal nil, field.cast_value('')
324 assert_nil field.cast_value(nil)
325 assert_nil field.cast_value('')
326 326 end
327 327
328 328 def test_float_cast_valid_value_should_return_float
@@ -62,8 +62,8 class CustomFieldUserFormatTest < ActiveSupport::TestCase
62 62 end
63 63
64 64 def test_cast_blank_value
65 assert_equal nil, @field.cast_value(nil)
66 assert_equal nil, @field.cast_value("")
65 assert_nil @field.cast_value(nil)
66 assert_nil @field.cast_value("")
67 67 end
68 68
69 69 def test_cast_valid_value
@@ -73,6 +73,6 class CustomFieldUserFormatTest < ActiveSupport::TestCase
73 73 end
74 74
75 75 def test_cast_invalid_value
76 assert_equal nil, @field.cast_value("187")
76 assert_nil @field.cast_value("187")
77 77 end
78 78 end
@@ -45,8 +45,8 class CustomFieldVersionFormatTest < ActiveSupport::TestCase
45 45 end
46 46
47 47 def test_cast_blank_value
48 assert_equal nil, @field.cast_value(nil)
49 assert_equal nil, @field.cast_value("")
48 assert_nil @field.cast_value(nil)
49 assert_nil @field.cast_value("")
50 50 end
51 51
52 52 def test_cast_valid_value
@@ -56,6 +56,6 class CustomFieldVersionFormatTest < ActiveSupport::TestCase
56 56 end
57 57
58 58 def test_cast_invalid_value
59 assert_equal nil, @field.cast_value("187")
59 assert_nil @field.cast_value("187")
60 60 end
61 61 end
@@ -130,7 +130,7 class GroupTest < ActiveSupport::TestCase
130 130 assert group.destroy
131 131 assert group.destroyed?
132 132
133 assert_equal nil, Issue.find(1).assigned_to_id
133 assert_nil Issue.find(1).assigned_to_id
134 134 end
135 135
136 136 def test_builtin_groups_should_be_created_if_missing
@@ -1020,7 +1020,7 EXPECTED
1020 1020 assert_equal 'test1/test2', to_path_param('test1/test2')
1021 1021 assert_equal 'test1/test2', to_path_param('/test1/test2/')
1022 1022 assert_equal 'test1/test2', to_path_param('//test1/test2/')
1023 assert_equal nil, to_path_param('/')
1023 assert_nil to_path_param('/')
1024 1024 end
1025 1025
1026 1026 def test_wiki_links_in_tables
@@ -1643,7 +1643,7 class IssueTest < ActiveSupport::TestCase
1643 1643 issue.reload
1644 1644 assert_equal 2, issue.project_id
1645 1645 # Cleared fixed_version
1646 assert_equal nil, issue.fixed_version
1646 assert_nil issue.fixed_version
1647 1647 end
1648 1648
1649 1649 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 1665 issue.reload
1666 1666 assert_equal 5, issue.project_id
1667 1667 # Cleared fixed_version
1668 assert_equal nil, issue.fixed_version
1668 assert_nil issue.fixed_version
1669 1669 end
1670 1670
1671 1671 def test_move_to_another_project_should_keep_fixed_version_when_shared_systemwide
@@ -201,7 +201,7 class JournalTest < ActiveSupport::TestCase
201 201
202 202 def test_custom_field_should_return_nil_for_non_cf_detail
203 203 d = JournalDetail.new(:property => 'subject')
204 assert_equal nil, d.custom_field
204 assert_nil d.custom_field
205 205 end
206 206
207 207 def test_visible_details_should_include_relations_to_visible_issues_only
@@ -51,7 +51,7 class Redmine::CodesetUtilTest < ActiveSupport::TestCase
51 51
52 52 def test_to_utf8_by_setting_blank_string
53 53 assert_equal "", Redmine::CodesetUtil.to_utf8_by_setting("")
54 assert_equal nil, Redmine::CodesetUtil.to_utf8_by_setting(nil)
54 assert_nil Redmine::CodesetUtil.to_utf8_by_setting(nil)
55 55 end
56 56
57 57 def test_to_utf8_by_setting_returns_ascii_as_utf8
@@ -94,9 +94,9 class PdfTest < ActiveSupport::TestCase
94 94 assert a2.readable?
95 95 assert (! a2.visible?)
96 96 aa1 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "Testfile.PNG", "UTF-8")
97 assert_equal nil, aa1
97 assert_nil aa1
98 98 aa2 = Redmine::Export::PDF::RDMPdfEncoding::attach(Attachment.all, "test#{str2}.png", encoding)
99 assert_equal nil, aa2
99 assert_nil aa2
100 100
101 101 set_tmp_attachments_directory
102 102 end
@@ -156,7 +156,7 class Redmine::MenuManager::MapperTest < ActiveSupport::TestCase
156 156 menu_mapper.push :test_overview, { :controller => 'projects', :action => 'show'}, {}
157 157
158 158 item = menu_mapper.find(:nothing)
159 assert_equal nil, item
159 assert_nil item
160 160 end
161 161
162 162 def test_delete
@@ -336,7 +336,7 class GitAdapterTest < ActiveSupport::TestCase
336 336 assert_equal 15, revs1.length
337 337 assert_equal "7234cb2750b63f47bff735edc50a1c0a433c2518",
338 338 revs1[0].identifier
339 assert_equal nil, revs1[0].parents
339 assert_nil revs1[0].parents
340 340 assert_equal "899a15dba03a3b350b89c3f537e4bbe02a03cdc9",
341 341 revs1[1].identifier
342 342 assert_equal 1, revs1[1].parents.length
@@ -477,8 +477,8 class GitAdapterTest < ActiveSupport::TestCase
477 477 assert entries1
478 478 assert_equal 3, entries1.size
479 479 f1 = entries1[1]
480 assert_equal nil, f1.name
481 assert_equal nil, f1.path
480 assert_nil f1.name
481 assert_nil f1.path
482 482 assert_equal 'file', f1.kind
483 483 end
484 484
@@ -353,8 +353,8 class ProjectTest < ActiveSupport::TestCase
353 353 issue_with_hierarchy_fixed_version.reload
354 354
355 355 assert_equal 4, issue_with_local_fixed_version.fixed_version_id, "Fixed version was not keep on an issue local to the moved project"
356 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"
357 assert_equal nil, parent_issue.fixed_version_id, "Fixed version is still set after moving the Version out of the hierarchy for the issue."
356 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"
357 assert_nil parent_issue.fixed_version_id, "Fixed version is still set after moving the Version out of the hierarchy for the issue."
358 358 end
359 359
360 360 def test_parent
@@ -149,7 +149,7 class RepositoryGitTest < ActiveSupport::TestCase
149 149 assert_equal 3, commit.filechanges.count
150 150 change = commit.filechanges.sort_by(&:path).first
151 151 assert_equal "README", change.path
152 assert_equal nil, change.from_path
152 assert_nil change.from_path
153 153 assert_equal "A", change.action
154 154
155 155 assert_equal NUM_HEAD, @repository.extra_info["heads"].size
@@ -611,7 +611,7 class UserTest < ActiveSupport::TestCase
611 611 @jsmith.save!
612 612
613 613 user = User.try_to_login("jsmith", "jsmith")
614 assert_equal nil, user
614 assert_nil user
615 615 end
616 616
617 617 def test_try_to_login_with_locked_user_and_not_active_only_should_return_user
@@ -645,11 +645,11 class UserTest < ActiveSupport::TestCase
645 645 auth_source = AuthSourceLdap.find(1)
646 646 AuthSource.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError, 'Cannot connect')
647 647
648 assert_equal nil, User.try_to_login('edavis', 'wrong')
648 assert_nil User.try_to_login('edavis', 'wrong')
649 649 end
650 650
651 651 test "#try_to_login using LDAP" do
652 assert_equal nil, User.try_to_login('edavis', 'wrong')
652 assert_nil User.try_to_login('edavis', 'wrong')
653 653 end
654 654
655 655 test "#try_to_login using LDAP binding with user's account" do
@@ -243,12 +243,12 class VersionTest < ActiveSupport::TestCase
243 243
244 244 # Project 1 now out of the shared scope
245 245 project_1_issue.reload
246 assert_equal nil, project_1_issue.fixed_version,
246 assert_nil project_1_issue.fixed_version,
247 247 "Fixed version is still set after changing the Version's sharing"
248 248
249 249 # Project 5 now out of the shared scope
250 250 project_5_issue.reload
251 assert_equal nil, project_5_issue.fixed_version,
251 assert_nil project_5_issue.fixed_version,
252 252 "Fixed version is still set after changing the Version's sharing"
253 253
254 254 # Project 2 issue remains
@@ -107,7 +107,7 class WikiPageTest < ActiveSupport::TestCase
107 107
108 108 child.wiki_id = 2
109 109 child.save!
110 assert_equal nil, child.reload.parent_id
110 assert_nil child.reload.parent_id
111 111 end
112 112
113 113 def test_move_parent_should_move_child_page
General Comments 0
You need to be logged in to leave comments. Login now