Disable jQuery animations during Rails tests

If you have Capybara tests in your project, you might run into sparatic test failures where elements are not available in a state that you think they will be in because of jQuery animations that occur on the elements.

You can add the following to your Rails layouts to tell jQuery to ignore any animations:

<%= javascript_tag '$.fx.off = true;' if Rails.env.test? %>

Jonathan Knapp About 12 years ago