@@ -37,7 +37,7 class Tracker < ActiveRecord::Base | |||||
37 | def to_s; name end |
|
37 | def to_s; name end | |
38 |
|
38 | |||
39 | def <=>(tracker) |
|
39 | def <=>(tracker) | |
40 |
n |
|
40 | position <=> tracker.position | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | def self.all |
|
43 | def self.all |
@@ -50,4 +50,11 class TrackerTest < ActiveSupport::TestCase | |||||
50 | def test_issue_statuses_should_be_empty_for_new_record |
|
50 | def test_issue_statuses_should_be_empty_for_new_record | |
51 | assert_equal [], Tracker.new.issue_statuses |
|
51 | assert_equal [], Tracker.new.issue_statuses | |
52 | end |
|
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 | end |
|
60 | end |
General Comments 0
You need to be logged in to leave comments.
Login now