Disable jQuery animations during Rails tests

Posted . Visible to the public.

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
Last edit
Posted by Jonathan Knapp to Knowledge is Power! (2012-03-22 15:09)