From b214205d8f4778825b410fcbbe280f83922a8060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 5 Feb 2021 17:01:46 +0100 Subject: [PATCH] Use Capybara to disable animations in tests We were doing it manually, but Capybara offers an option which does the exact same thing. This way we also apply the NoJavascriptTagHelper ERB rule, which reported one error in the `disable_animations_in_tests` partial. --- .erb-lint.yml | 2 ++ app/views/layouts/_common_head.html.erb | 1 - app/views/layouts/_disable_animations_in_tests.html.erb | 8 -------- spec/rails_helper.rb | 1 + 4 files changed, 3 insertions(+), 9 deletions(-) delete mode 100644 app/views/layouts/_disable_animations_in_tests.html.erb diff --git a/.erb-lint.yml b/.erb-lint.yml index ec457aa0c..1643ea6f6 100644 --- a/.erb-lint.yml +++ b/.erb-lint.yml @@ -8,6 +8,8 @@ linters: enabled: true FinalNewline: enabled: true + NoJavascriptTagHelper: + enabled: true SelfClosingTag: enabled: false SpaceAroundErbTag: diff --git a/app/views/layouts/_common_head.html.erb b/app/views/layouts/_common_head.html.erb index f034f7baf..d4c0d4daf 100644 --- a/app/views/layouts/_common_head.html.erb +++ b/app/views/layouts/_common_head.html.erb @@ -6,4 +6,3 @@ <%= javascript_include_tag "application", "data-turbolinks-track" => "reload" %> <%= csrf_meta_tags %> <%= favicon_link_tag "favicon.ico" %> -<%= render "layouts/disable_animations_in_tests" if Rails.env.test? %> diff --git a/app/views/layouts/_disable_animations_in_tests.html.erb b/app/views/layouts/_disable_animations_in_tests.html.erb deleted file mode 100644 index e2df3fe4e..000000000 --- a/app/views/layouts/_disable_animations_in_tests.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%= javascript_tag "jQuery.fx.off = true" %> - diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 44e369ffa..29fc2eece 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -47,5 +47,6 @@ end Capybara.exact = true Capybara.enable_aria_label = true +Capybara.disable_animation = true OmniAuth.config.test_mode = true