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