aboutsummaryrefslogtreecommitdiffstats
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/customstates.rb17
-rw-r--r--spec/models/info_request_spec.rb3
2 files changed, 13 insertions, 7 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
diff --git a/spec/models/info_request_spec.rb b/spec/models/info_request_spec.rb
index c13eda8cb..ab1ef1ce0 100644
--- a/spec/models/info_request_spec.rb
+++ b/spec/models/info_request_spec.rb
@@ -166,8 +166,9 @@ describe InfoRequest do
before do
InfoRequest.send(:require, File.expand_path(File.dirname(__FILE__) + '/customstates'))
+ InfoRequest.send(:include, InfoRequestCustomStates)
+ InfoRequest.class_eval('@@custom_states_loaded = true')
@ir = info_requests(:naughty_chicken_request)
- @ir.load_custom_states!
end
it "rejects invalid states" do