From f047d9f351088c901ea3f6f68758fd2878502434 Mon Sep 17 00:00:00 2001 From: grosser Date: Wed, 10 Dec 2014 20:35:30 -0800 Subject: [PATCH] Revert "Revert "Merge pull request #28 from grosser/grosser/test-load"" This reverts commit bc8041559a11c16ef25228b019250b3cc122e115. --- lib/prototype-rails/on_load_action_view.rb | 8 +++++--- test/lib/abstract_unit.rb | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/prototype-rails/on_load_action_view.rb b/lib/prototype-rails/on_load_action_view.rb index 2332d68..8942274 100644 --- a/lib/prototype-rails/on_load_action_view.rb +++ b/lib/prototype-rails/on_load_action_view.rb @@ -14,9 +14,11 @@ include ActionView::Helpers::ScriptaculousHelper end -ActionView::TestCase.class_eval do - include ActionView::Helpers::PrototypeHelper - include ActionView::Helpers::ScriptaculousHelper +if defined?(Rails.env) && Rails.env.test? + ActionView::TestCase.class_eval do + include ActionView::Helpers::PrototypeHelper + include ActionView::Helpers::ScriptaculousHelper + end end ActionView::Template.register_template_handler :rjs, ActionView::Template::Handlers::RJS.new diff --git a/test/lib/abstract_unit.rb b/test/lib/abstract_unit.rb index 41b92e0..f5feb8d 100644 --- a/test/lib/abstract_unit.rb +++ b/test/lib/abstract_unit.rb @@ -8,6 +8,12 @@ require 'action_view' require 'action_view/testing/resolvers' +module Rails + def self.env + ActiveSupport::StringInquirer.new("test") + end +end + require 'prototype-rails/on_load_action_controller' require 'prototype-rails/on_load_action_view'