@@ -28,6 +28,7 class IssueStatus < ActiveRecord::Base | |||
|
28 | 28 | validates_length_of :name, :maximum => 30 |
|
29 | 29 | validates_inclusion_of :default_done_ratio, :in => 0..100, :allow_nil => true |
|
30 | 30 | |
|
31 | scope :sorted, order("#{table_name}.position ASC") | |
|
31 | 32 | scope :named, lambda {|arg| where(["LOWER(#{table_name}.name) = LOWER(?)", arg.to_s.strip])} |
|
32 | 33 | |
|
33 | 34 | def update_default |
@@ -112,6 +112,10 class IssueStatusTest < ActiveSupport::TestCase | |||
|
112 | 112 | end |
|
113 | 113 | end |
|
114 | 114 | |
|
115 | def test_sorted_scope | |
|
116 | assert_equal IssueStatus.all.sort, IssueStatus.sorted.all | |
|
117 | end | |
|
118 | ||
|
115 | 119 | def test_named_scope |
|
116 | 120 | status = IssueStatus.named("resolved").first |
|
117 | 121 | assert_not_nil status |
General Comments 0
You need to be logged in to leave comments.
Login now