validates_length_of :name, :maximum => 30
validates_format_of :name, :with => /^[\w\s\'\-]*$/i
- def before_save
- IssueStatus.update_all "is_default=#{connection.quoted_false}" if self.is_default?
+ def after_save
+ IssueStatus.update_all("is_default=#{connection.quoted_false}", ['id <> ?', id]) if self.is_default?
end
# Returns the default status for new issues
assert_equal status, IssueStatus.default
assert !IssueStatus.find(1).is_default
end
+
+ def test_reorder_should_not_clear_default_status
+ status = IssueStatus.default
+ status.move_to_bottom
+ status.reload
+ assert status.is_default?
+ end
end