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