diff options
author | Seb Bacon <seb.bacon@gmail.com> | 2011-07-12 14:36:55 +0100 |
---|---|---|
committer | Seb Bacon <seb.bacon@gmail.com> | 2011-07-12 14:36:55 +0100 |
commit | 8ca2f1fca08b8d645040bba2d83b77a889067b23 (patch) | |
tree | 9fe956d70154e4c162454e099a331f4e0386293e /spec/models/customstates.rb | |
parent | 15973386cb4f412cf439414ef908d4594c897f24 (diff) |
Refactor custom states loading (use class methods where appropriate, simplify main code at the cost (small) of test legibility)
Diffstat (limited to 'spec/models/customstates.rb')
-rw-r--r-- | spec/models/customstates.rb | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/spec/models/customstates.rb b/spec/models/customstates.rb index de8d04ffb..406d4ead9 100644 --- a/spec/models/customstates.rb +++ b/spec/models/customstates.rb @@ -1,4 +1,9 @@ module InfoRequestCustomStates + + def self.included(base) + base.extend(ClassMethods) + end + # Mixin methods for InfoRequest def theme_display_status(status) if status == 'deadline_extended' @@ -10,12 +15,6 @@ module InfoRequestCustomStates end end - def theme_extra_states - return ['deadline_extended', - 'wrong_response'] - end - - def theme_calculate_status return 'waiting_classification' if self.awaiting_description waiting_response = self.described_state == "waiting_response" || self.described_state == "deadline_extended" @@ -41,6 +40,12 @@ module InfoRequestCustomStates return Holiday.due_date_from(self.date_response_required_by, 15) end + module ClassMethods + def theme_extra_states + return ['deadline_extended', + 'wrong_response'] + end + end end module RequestControllerCustomStates |