gazay / gon

Your Rails variables in your JS
MIT License
3.05k stars 184 forks source link

fix overriding ActionController::Live with test_behaviour when not test mode #243

Closed rcugut closed 6 years ago

rcugut commented 6 years ago

This fixes the (unintentional?) loading of ActionController::TestCase::Behavior in non-test environment, which breaks the method ActionController::Live#new_controller_thread and makes the server to hang.

basic demo project to show the issue: https://github.com/rcugut/xlsxtream_playground

gazay commented 6 years ago

I think it's better to use ENV['RAILS_ENV'] here instead of Rails.env as gon doesn't require all rails parts and specs are failing because of that. But I totally agree with this fix, thank you very much for finding it!

rcugut commented 6 years ago

Good suggestion. I did another commit with it.

However IMO this should be better addressed in the Rails codebase itself. It's an undesired side-effect that nobody really expects to come into, when they just "require" (or autoload) a module.

gazay commented 6 years ago

Fixed with https://github.com/gazay/gon/pull/252