mirror of
https://github.com/redmine/redmine.git
synced 2025-11-13 00:36:01 +01:00
Don't use assert_equal nil.
git-svn-id: http://svn.redmine.org/redmine/trunk@16064 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1
test/fixtures/attachments.yml
vendored
1
test/fixtures/attachments.yml
vendored
@@ -12,6 +12,7 @@ attachments_001:
|
|||||||
filesize: 28
|
filesize: 28
|
||||||
filename: error281.txt
|
filename: error281.txt
|
||||||
author_id: 2
|
author_id: 2
|
||||||
|
description: An attachment
|
||||||
attachments_002:
|
attachments_002:
|
||||||
created_on: 2007-01-27 15:08:27 +01:00
|
created_on: 2007-01-27 15:08:27 +01:00
|
||||||
downloads: 0
|
downloads: 0
|
||||||
|
|||||||
@@ -4457,7 +4457,11 @@ class IssuesControllerTest < Redmine::ControllerTest
|
|||||||
assert_equal orig.project_id, copy.project_id
|
assert_equal orig.project_id, copy.project_id
|
||||||
assert_equal orig.tracker_id, copy.tracker_id
|
assert_equal orig.tracker_id, copy.tracker_id
|
||||||
assert_equal orig.status_id, copy.status_id
|
assert_equal orig.status_id, copy.status_id
|
||||||
assert_equal orig.assigned_to_id, copy.assigned_to_id
|
if orig.assigned_to_id
|
||||||
|
assert_equal orig.assigned_to_id, copy.assigned_to_id
|
||||||
|
else
|
||||||
|
assert_nil copy.assigned_to_id
|
||||||
|
end
|
||||||
assert_equal orig.priority_id, copy.priority_id
|
assert_equal orig.priority_id, copy.priority_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -356,6 +356,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
|||||||
|
|
||||||
test "GET /issues/:id.xml should contains total_estimated_hours and total_spent_hours" do
|
test "GET /issues/:id.xml should contains total_estimated_hours and total_spent_hours" do
|
||||||
parent = Issue.find(3)
|
parent = Issue.find(3)
|
||||||
|
parent.update_columns :estimated_hours => 2.0
|
||||||
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
|
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
|
||||||
TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
|
TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
|
||||||
:hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
|
:hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
|
||||||
@@ -372,6 +373,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
|||||||
|
|
||||||
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
|
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
|
||||||
parent = Issue.find(3)
|
parent = Issue.find(3)
|
||||||
|
parent.update_columns :estimated_hours => 2.0
|
||||||
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
|
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
|
||||||
# remove permission!
|
# remove permission!
|
||||||
Role.anonymous.remove_permission! :view_time_entries
|
Role.anonymous.remove_permission! :view_time_entries
|
||||||
@@ -389,6 +391,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
|||||||
|
|
||||||
test "GET /issues/:id.json should contains total_estimated_hours and total_spent_hours" do
|
test "GET /issues/:id.json should contains total_estimated_hours and total_spent_hours" do
|
||||||
parent = Issue.find(3)
|
parent = Issue.find(3)
|
||||||
|
parent.update_columns :estimated_hours => 2.0
|
||||||
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
|
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
|
||||||
TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
|
TimeEntry.create!(:project => child.project, :issue => child, :user => child.author, :spent_on => child.author.today,
|
||||||
:hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
|
:hours => '2.5', :comments => '', :activity_id => TimeEntryActivity.first.id)
|
||||||
@@ -404,6 +407,7 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base
|
|||||||
|
|
||||||
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
|
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
|
||||||
parent = Issue.find(3)
|
parent = Issue.find(3)
|
||||||
|
parent.update_columns :estimated_hours => 2.0
|
||||||
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
|
child = Issue.generate!(:parent_issue_id => parent.id, :estimated_hours => 3.0)
|
||||||
# remove permission!
|
# remove permission!
|
||||||
Role.anonymous.remove_permission! :view_time_entries
|
Role.anonymous.remove_permission! :view_time_entries
|
||||||
|
|||||||
@@ -217,11 +217,14 @@ class Redmine::I18nTest < ActiveSupport::TestCase
|
|||||||
'Fr' => :fr,
|
'Fr' => :fr,
|
||||||
'zh' => :zh,
|
'zh' => :zh,
|
||||||
'zh-tw' => :"zh-TW",
|
'zh-tw' => :"zh-TW",
|
||||||
'zh-TW' => :"zh-TW",
|
'zh-TW' => :"zh-TW"}
|
||||||
'zh-ZZ' => nil }
|
|
||||||
to_test.each {|lang, expected| assert_equal expected, find_language(lang)}
|
to_test.each {|lang, expected| assert_equal expected, find_language(lang)}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_find_language_with_invalid_language_should_return_nil
|
||||||
|
assert_nil find_language('zh-ZZ')
|
||||||
|
end
|
||||||
|
|
||||||
def test_fallback
|
def test_fallback
|
||||||
::I18n.backend.store_translations(:en, {:untranslated => "Untranslated string"})
|
::I18n.backend.store_translations(:en, {:untranslated => "Untranslated string"})
|
||||||
::I18n.locale = 'en'
|
::I18n.locale = 'en'
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ require File.expand_path('../../../../test_helper', __FILE__)
|
|||||||
class Redmine::MimeTypeTest < ActiveSupport::TestCase
|
class Redmine::MimeTypeTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
def test_of
|
def test_of
|
||||||
to_test = {'test.unk' => nil,
|
to_test = {'test.txt' => 'text/plain',
|
||||||
'test.txt' => 'text/plain',
|
|
||||||
'test.c' => 'text/x-c',
|
'test.c' => 'text/x-c',
|
||||||
}
|
}
|
||||||
to_test.each do |name, expected|
|
to_test.each do |name, expected|
|
||||||
@@ -29,9 +28,12 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_of_with_unknown_type
|
||||||
|
assert_nil Redmine::MimeType.of('test.unk')
|
||||||
|
end
|
||||||
|
|
||||||
def test_css_class_of
|
def test_css_class_of
|
||||||
to_test = {'test.unk' => nil,
|
to_test = {'test.txt' => 'text-plain',
|
||||||
'test.txt' => 'text-plain',
|
|
||||||
'test.c' => 'text-x-c',
|
'test.c' => 'text-x-c',
|
||||||
}
|
}
|
||||||
to_test.each do |name, expected|
|
to_test.each do |name, expected|
|
||||||
@@ -39,9 +41,12 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_css_class_of_with_unknown_type
|
||||||
|
assert_nil Redmine::MimeType.css_class_of('test.unk')
|
||||||
|
end
|
||||||
|
|
||||||
def test_main_mimetype_of
|
def test_main_mimetype_of
|
||||||
to_test = {'test.unk' => nil,
|
to_test = {'test.txt' => 'text',
|
||||||
'test.txt' => 'text',
|
|
||||||
'test.c' => 'text',
|
'test.c' => 'text',
|
||||||
}
|
}
|
||||||
to_test.each do |name, expected|
|
to_test.each do |name, expected|
|
||||||
@@ -49,6 +54,10 @@ class Redmine::MimeTypeTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_main_mimetype_of_with_unknown_type
|
||||||
|
assert_nil Redmine::MimeType.main_mimetype_of('test.unk')
|
||||||
|
end
|
||||||
|
|
||||||
def test_is_type
|
def test_is_type
|
||||||
to_test = {['text', 'test.unk'] => false,
|
to_test = {['text', 'test.unk'] => false,
|
||||||
['text', 'test.txt'] => true,
|
['text', 'test.txt'] => true,
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class TrackerTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_named_scope
|
def test_named_scope
|
||||||
assert_equal Tracker.find_by_name('Feature'), Tracker.named('feature').first
|
assert_equal Tracker.find(2), Tracker.named('feature request').first
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_visible_scope_chained_with_project_rolled_up_trackers
|
def test_visible_scope_chained_with_project_rolled_up_trackers
|
||||||
|
|||||||
Reference in New Issue
Block a user