Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

do not load test-case in development #28

Merged
merged 2 commits into from

3 participants

@grosser

can you also pick this to the rails 3 branch ?

@grosser

bump

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 Rails.env.test?
@rafaelfranca Owner

This entire code should be inside the Railtie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@grosser

better ?

lib/prototype-rails.rb
((12 lines not shown))
+ require 'action_view/helpers/scriptaculous_helper'
+ require 'action_view/template/handlers/rjs'
+ require 'prototype-rails/javascript_helper'
+ require 'prototype-rails/rendering'
+
+ ActionView::Base.class_eval do
+ cattr_accessor :debug_rjs
+ self.debug_rjs = false
+ end
+
+ ActionView::Base.class_eval do
+ include ActionView::Helpers::PrototypeHelper
+ include ActionView::Helpers::ScriptaculousHelper
+ end
+
+ if Rails.env.test? # do not trigger test-case autoload in development/production
@rafaelfranca Owner

Sorry. I was talking about only the Rails.env check and the conditional inclusion of modules at TestCase. The rest of the code is fine to be in that file

@grosser
grosser added a note
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@rafaelfranca
Owner

:+1:

@grosser

Can you also merge and release this?

@rafaelfranca
Owner

Sure! It is in my TODO list. Will be the first thing I'll do tomorrow

@grosser

Hmm tomorrow is gone :)

@rafaelfranca
Owner

yes, yes. Sorry I have a lot of work to do.

But you can always install a gem pointing to your fork using bundler if you have hurry :wink:

@grosser
@rafaelfranca rafaelfranca merged commit 3f512ec into rails:master
@rafaelfranca
Owner

Now I can work on this. Thanks :heart:

@grosser

bump :)
(please also release for the rails 3 branch/tag, I can make a PR if that helps, just picking the commit on the latest rails 3 tag)

@rafaelfranca

Really sorry but before releasing the gem I want to do some work. Like I said we don't need to hurry to release the gem since you can always use bundler.

@grosser
@rafaelfranca

I want to review all the open PR and issues and see if I can merge/fix something else before releasing, so the release will help more people

@grosser

no more PR's left except some 6month + olds, ready to release ?

@rafaelfranca rafaelfranca referenced this pull request from a commit
@rafaelfranca rafaelfranca Revert "Merge pull request #28 from grosser/grosser/test-load"
This reverts commit 3f512ec, reversing
changes made to 2841450.

Reason: I'll use the solution in
#23 that doesn't check the
Rails environment
bc80415
@guigs

This would solve #32 on Rails 4.2.

@guigs guigs referenced this pull request from a commit in guigs/prototype-rails
@guigs guigs Revert "Revert "Merge pull request #28 from grosser/grosser/test-load""
This reverts commit bc80415.
e454a7a
@grosser grosser referenced this pull request from a commit in grosser/prototype-rails
@grosser grosser Revert "Revert "Merge pull request #28 from grosser/grosser/test-load""
This reverts commit bc80415.
e423f5a
@grosser grosser referenced this pull request from a commit in grosser/prototype-rails
@grosser grosser Revert "Revert "Merge pull request #28 from grosser/grosser/test-load""
This reverts commit bc80415.
d77027c
@grosser grosser referenced this pull request from a commit in grosser/prototype-rails
@grosser grosser Revert "Revert "Merge pull request #28 from grosser/grosser/test-load""
This reverts commit bc80415.
f047d9f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 27, 2013
  1. @grosser
Commits on Jan 3, 2014
  1. @grosser

    move env check to railtie

    grosser authored
This page is out of date. Refresh to see the latest.
View
6 lib/prototype-rails.rb
@@ -10,6 +10,12 @@ class Engine < Rails::Engine
ActiveSupport.on_load(:action_view) do
require 'prototype-rails/on_load_action_view'
+ if Rails.env.test?
+ ActionView::TestCase.class_eval do
+ include ActionView::Helpers::PrototypeHelper
+ include ActionView::Helpers::ScriptaculousHelper
+ end
+ end
end
end
end
View
5 lib/prototype-rails/on_load_action_view.rb
@@ -14,9 +14,4 @@
include ActionView::Helpers::ScriptaculousHelper
end
-ActionView::TestCase.class_eval do
- include ActionView::Helpers::PrototypeHelper
- include ActionView::Helpers::ScriptaculousHelper
-end
-
ActionView::Template.register_template_handler :rjs, ActionView::Template::Handlers::RJS.new
View
6 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'
Something went wrong with that request. Please try again.