diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index c05c88892..ff41ea1ea 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -16,11 +16,6 @@
<%= content_for :social_media_meta_tags %>
<%= setting['per_page_code'].try(:html_safe) %>
-
- <% if Rails.env.test? %>
- <%= javascript_tag "$.fx.off = true;" %>
- <% end %>
-
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 902bc040a..6c856cc50 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -28,7 +28,8 @@ Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app,
inspector: true, # allows remote debugging by executing page.driver.debug
phantomjs_logger: File.open(File::NULL, "w"), # don't print console.log calls in console
- phantomjs_options: ['--load-images=no', '--disk-cache=false']
+ phantomjs_options: ['--load-images=no', '--disk-cache=false'],
+ extensions: [File.expand_path("../support/phantomjs_ext/disable_js_fx.js", __FILE__)] # disable js effects
)
end
diff --git a/spec/support/phantomjs_ext/disable_js_fx.js b/spec/support/phantomjs_ext/disable_js_fx.js
new file mode 100644
index 000000000..2b97f0a0f
--- /dev/null
+++ b/spec/support/phantomjs_ext/disable_js_fx.js
@@ -0,0 +1,3 @@
+document.addEventListener("DOMContentLoaded", function() {
+ $.fx.off = true;
+});