diff options
author | Louise Crow <louise.crow@gmail.com> | 2013-02-19 09:56:17 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2013-02-19 09:56:17 +0000 |
commit | e7067b87777b5f2dd301a852ca6f8f5af1f135b4 (patch) | |
tree | f49178156b85a8c124d6638df086c0e3c86b2276 | |
parent | 870d948c27607634e94eaca467cefa0e66ac0eb1 (diff) |
Move test runner disabling to request mailer in order to have access to rails environment and make hack specific to ruby 1.9.
-rw-r--r-- | app/models/request_mailer.rb | 6 | ||||
-rwxr-xr-x | script/runner | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/app/models/request_mailer.rb b/app/models/request_mailer.rb index 493d6961c..dc2c5fe21 100644 --- a/app/models/request_mailer.rb +++ b/app/models/request_mailer.rb @@ -5,7 +5,11 @@ # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ require 'alaveteli_file_types' - +if Rails.env == 'test' && RUBY_VERSION.to_f >= 1.9 + # Avoid spec/script/mailin_spec.rb running script/runner as a test suite + # http://stackoverflow.com/questions/1899009/why-are-tests-running-in-production-mode-and-causing-my-script-runners-to-fail + Test::Unit.run = true +end class RequestMailer < ApplicationMailer diff --git a/script/runner b/script/runner index cb34f9187..1575848de 100755 --- a/script/runner +++ b/script/runner @@ -1,11 +1,7 @@ #!/usr/bin/env ruby daemon_mode = !ARGV.empty? && ARGV[0] == "--daemon" -if Rails.env == 'test' - # Avoid spec/script/mailin_spec.rb running script/runner as a test suite - # http://stackoverflow.com/questions/1899009/why-are-tests-running-in-production-mode-and-causing-my-script-runners-to-fail - Test::Unit.run = true -end + script_dir = File.dirname(__FILE__) alaveteli_dir = File.expand_path(File.join(script_dir, "..")) |