##// END OF EJS Templates
Don't use assert_equal nil....
Jean-Philippe Lang -
r15682:3186130966ce
parent child
Show More
@@ -12,6 +12,7 attachments_001:
12 filesize: 28
12 filesize: 28
13 filename: error281.txt
13 filename: error281.txt
14 author_id: 2
14 author_id: 2
15 description: An attachment
15 attachments_002:
16 attachments_002:
16 created_on: 2007-01-27 15:08:27 +01:00
17 created_on: 2007-01-27 15:08:27 +01:00
17 downloads: 0
18 downloads: 0
@@ -4457,7 +4457,11 class IssuesControllerTest < Redmine::ControllerTest
4457 assert_equal orig.project_id, copy.project_id
4457 assert_equal orig.project_id, copy.project_id
4458 assert_equal orig.tracker_id, copy.tracker_id
4458 assert_equal orig.tracker_id, copy.tracker_id
4459 assert_equal orig.status_id, copy.status_id
4459 assert_equal orig.status_id, copy.status_id
4460 assert_equal orig.assigned_to_id, copy.assigned_to_id
4460 if orig.assigned_to_id
4461 assert_equal orig.assigned_to_id, copy.assigned_to_id
4462 else
4463 assert_nil copy.assigned_to_id
4464 end
4461 assert_equal orig.priority_id, copy.priority_id
4465 assert_equal orig.priority_id, copy.priority_id
4462 end
4466 end
4463 end
4467 end
@@ -356,6 +356,7 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
356
356
357 test "GET /issues/:id.xml should contains total_estimated_hours and total_spent_hours" do
357 test "GET /issues/:id.xml should contains total_estimated_hours and total_spent_hours" do
358 parent = Issue.find(3)
358 parent = Issue.find(3)
359 parent.update_columns :estimated_hours => 2.0
359 child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
360 child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
360 TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
361 TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
361 :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
362 :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
@@ -372,6 +373,7 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
372
373
373 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
374 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
374 parent = Issue.find(3)
375 parent = Issue.find(3)
376 parent.update_columns :estimated_hours => 2.0
375 child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
377 child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
376 # remove permission!
378 # remove permission!
377 Role.anonymous.remove_permission! :view_time_entries
379 Role.anonymous.remove_permission! :view_time_entries
@@ -389,6 +391,7 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
389
391
390 test "GET /issues/:id.json should contains total_estimated_hours and total_spent_hours" do
392 test "GET /issues/:id.json should contains total_estimated_hours and total_spent_hours" do
391 parent = Issue.find(3)
393 parent = Issue.find(3)
394 parent.update_columns :estimated_hours => 2.0
392 child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
395 child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
393 TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
396 TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
394 :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
397 :hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
@@ -404,6 +407,7 class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
404
407
405 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
408 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
406 parent = Issue.find(3)
409 parent = Issue.find(3)
410 parent.update_columns :estimated_hours => 2.0
407 child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
411 child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
408 # remove permission!
412 # remove permission!
409 Role.anonymous.remove_permission! :view_time_entries
413 Role.anonymous.remove_permission! :view_time_entries
@@ -217,11 +217,14 class Redmine::I18nTest < ActiveSupport::TestCase
217 'Fr' => :fr,
217 'Fr' => :fr,
218 'zh' => :zh,
218 'zh' => :zh,
219 'zh-tw' => :"zh-TW",
219 'zh-tw' => :"zh-TW",
220 'zh-TW' => :"zh-TW",
220 'zh-TW' => :"zh-TW"}
221 'zh-ZZ' => nil }
222 to_test.each {|lang, expected| assert_equal expected, find_language(lang)}
221 to_test.each {|lang, expected| assert_equal expected, find_language(lang)}
223 end
222 end
224
223
224 def test_find_language_with_invalid_language_should_return_nil
225 assert_nil find_language('zh-ZZ')
226 end
227
225 def test_fallback
228 def test_fallback
226 ::I18n.backend.store_translations(:en, {:untranslated => "Untranslated string"})
229 ::I18n.backend.store_translations(:en, {:untranslated => "Untranslated string"})
227 ::I18n.locale = 'en'
230 ::I18n.locale = 'en'
@@ -20,8 +20,7 require File.expand_path('../../../../test_helper', __FILE__)
20 class Redmine::MimeTypeTest < ActiveSupport::TestCase
20 class Redmine::MimeTypeTest < ActiveSupport::TestCase
21
21
22 def test_of
22 def test_of
23 to_test = {'test.unk' => nil,
23 to_test = {'test.txt' => 'text/plain',
24 'test.txt' => 'text/plain',
25 'test.c' => 'text/x-c',
24 'test.c' => 'text/x-c',
26 }
25 }
27 to_test.each do |name, expected|
26 to_test.each do |name, expected|
@@ -29,9 +28,12 class Redmine::MimeTypeTest < ActiveSupport::TestCase
29 end
28 end
30 end
29 end
31
30
31 def test_of_with_unknown_type
32 assert_nil Redmine::MimeType.of('test.unk')
33 end
34
32 def test_css_class_of
35 def test_css_class_of
33 to_test = {'test.unk' => nil,
36 to_test = {'test.txt' => 'text-plain',
34 'test.txt' => 'text-plain',
35 'test.c' => 'text-x-c',
37 'test.c' => 'text-x-c',
36 }
38 }
37 to_test.each do |name, expected|
39 to_test.each do |name, expected|
@@ -39,9 +41,12 class Redmine::MimeTypeTest < ActiveSupport::TestCase
39 end
41 end
40 end
42 end
41
43
44 def test_css_class_of_with_unknown_type
45 assert_nil Redmine::MimeType.css_class_of('test.unk')
46 end
47
42 def test_main_mimetype_of
48 def test_main_mimetype_of
43 to_test = {'test.unk' => nil,
49 to_test = {'test.txt' => 'text',
44 'test.txt' => 'text',
45 'test.c' => 'text',
50 'test.c' => 'text',
46 }
51 }
47 to_test.each do |name, expected|
52 to_test.each do |name, expected|
@@ -49,6 +54,10 class Redmine::MimeTypeTest < ActiveSupport::TestCase
49 end
54 end
50 end
55 end
51
56
57 def test_main_mimetype_of_with_unknown_type
58 assert_nil Redmine::MimeType.main_mimetype_of('test.unk')
59 end
60
52 def test_is_type
61 def test_is_type
53 to_test = {['text', 'test.unk'] => false,
62 to_test = {['text', 'test.unk'] => false,
54 ['text', 'test.txt'] => true,
63 ['text', 'test.txt'] => true,
@@ -25,7 +25,7 class TrackerTest < ActiveSupport::TestCase
25 end
25 end
26
26
27 def test_named_scope
27 def test_named_scope
28 assert_equal Tracker.find_by_name('Feature'), Tracker.named('feature').first
28 assert_equal Tracker.find(2), Tracker.named('feature request').first
29 end
29 end
30
30
31 def test_visible_scope_chained_with_project_rolled_up_trackers
31 def test_visible_scope_chained_with_project_rolled_up_trackers
General Comments 0
You need to be logged in to leave comments. Login now