From 5ae7a5512deb6fef5f03d8a449f69174287c3ab3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 9 Aug 2018 17:40:38 +0200 Subject: [PATCH] Skip spec before doing any requests Skipping a spec in the middle of it, particularly after doing some requests, caused Capybara to keep using the same driver in the following spec. Since the current spec uses the JavaScript driver, the next test would also use the JavaScript driver, causing apparently random failures if that test was supposed to use the Rack driver. --- spec/shared/features/nested_imageable.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/spec/shared/features/nested_imageable.rb b/spec/shared/features/nested_imageable.rb index c8bdb9556..f508366fc 100644 --- a/spec/shared/features/nested_imageable.rb +++ b/spec/shared/features/nested_imageable.rb @@ -175,15 +175,14 @@ shared_examples "nested imageable" do |imageable_factory_name, path, end scenario "Should show successful notice when resource filled correctly without any nested images", :js do - login_as user - visit send(path, arguments) - - send(fill_resource_method_name) if fill_resource_method_name - click_on submit_button - if has_many_images skip "no need to test, there are no attributes for the parent resource" else + login_as user + visit send(path, arguments) + + send(fill_resource_method_name) if fill_resource_method_name + click_on submit_button expect(page).to have_content imageable_success_notice end end