From 3dfc53f6b82b3c5da79a4c710d45b859f61f4f5f Mon Sep 17 00:00:00 2001 From: Seb Bacon Date: Tue, 12 Jul 2011 13:39:06 +0100 Subject: ensure we don't load custom states from plugins when running tests --- app/models/info_request.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/models/info_request.rb') diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 16e66c44a..c51e0c546 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -132,13 +132,19 @@ class InfoRequest < ActiveRecord::Base end def load_custom_states + @@custom_states_loaded = false + if !ENV["RAILS_ENV"] == "test" + load_custom_states! + end + end + + def load_custom_states! begin # InfoRequestCustomStates may be `require`d in a theme # plugin, or by a test InfoRequest.send(:include, InfoRequestCustomStates) @@custom_states_loaded = true rescue NameError - @@custom_states_loaded = false end end -- cgit v1.2.3