summaryrefslogtreecommitdiffstats
path: root/test/unit/tracker_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-25 20:18:55 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-05-25 20:18:55 +0000
commit59cbc68dde9cda2178e9194746f60a2161d973bf (patch)
tree55e321ea1efceaa744546b0571ce7d9f93c70487 /test/unit/tracker_test.rb
parent221585c7b5708659e9059b6119846948b07570bb (diff)
downloadredmine-59cbc68dde9cda2178e9194746f60a2161d973bf.tar.gz
redmine-59cbc68dde9cda2178e9194746f60a2161d973bf.zip
Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9714 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/tracker_test.rb')
-rw-r--r--test/unit/tracker_test.rb31
1 files changed, 30 insertions, 1 deletions
diff --git a/test/unit/tracker_test.rb b/test/unit/tracker_test.rb
index 493637db5..9cf6866a9 100644
--- a/test/unit/tracker_test.rb
+++ b/test/unit/tracker_test.rb
@@ -18,7 +18,15 @@
require File.expand_path('../../test_helper', __FILE__)
class TrackerTest < ActiveSupport::TestCase
- fixtures :trackers, :workflows, :issue_statuses, :roles
+ fixtures :trackers, :workflows, :issue_statuses, :roles, :issues
+
+ def test_sorted_scope
+ assert_equal Tracker.all.sort, Tracker.sorted.all
+ end
+
+ def test_named_scope
+ assert_equal Tracker.find_by_name('Feature'), Tracker.named('feature').first
+ end
def test_copy_workflows
source = Tracker.find(1)
@@ -57,4 +65,25 @@ class TrackerTest < ActiveSupport::TestCase
assert_equal [b, a], [a, b].sort
end
+
+ def test_destroying_a_tracker_without_issues_should_not_raise_an_error
+ tracker = Tracker.find(1)
+ Issue.delete_all :tracker_id => tracker.id
+
+ assert_difference 'Tracker.count', -1 do
+ assert_nothing_raised do
+ tracker.destroy
+ end
+ end
+ end
+
+ def test_destroying_a_tracker_with_issues_should_raise_an_error
+ tracker = Tracker.find(1)
+
+ assert_no_difference 'Tracker.count' do
+ assert_raise Exception do
+ tracker.destroy
+ end
+ end
+ end
end