@@ -37,7 +37,7 class Tracker < ActiveRecord::Base | |||
|
37 | 37 | def to_s; name end |
|
38 | 38 | |
|
39 | 39 | def <=>(tracker) |
|
40 |
n |
|
|
40 | position <=> tracker.position | |
|
41 | 41 | end |
|
42 | 42 | |
|
43 | 43 | def self.all |
@@ -50,4 +50,11 class TrackerTest < ActiveSupport::TestCase | |||
|
50 | 50 | def test_issue_statuses_should_be_empty_for_new_record |
|
51 | 51 | assert_equal [], Tracker.new.issue_statuses |
|
52 | 52 | end |
|
53 | ||
|
54 | def test_sort_should_sort_by_position | |
|
55 | a = Tracker.new(:name => 'Tracker A', :position => 2) | |
|
56 | b = Tracker.new(:name => 'Tracker B', :position => 1) | |
|
57 | ||
|
58 | assert_equal [b, a], [a, b].sort | |
|
59 | end | |
|
53 | 60 | end |
General Comments 0
You need to be logged in to leave comments.
Login now