summaryrefslogtreecommitdiffstats
path: root/test/unit/tracker_test.rb
diff options
context:
space:
mode:
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