From 9be6293282dfbb33ae3144f48c9428b3f3c55913 Mon Sep 17 00:00:00 2001 From: Thomas Walpole Date: Fri, 13 Apr 2018 14:49:28 -0700 Subject: [PATCH] Mark Rspec matcher tests that require JS support --- spec/rack_test_spec.rb | 5 +++-- spec/rspec/shared_spec_matchers.rb | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/spec/rack_test_spec.rb b/spec/rack_test_spec.rb index 2feb7984..be8b2dd4 100644 --- a/spec/rack_test_spec.rb +++ b/spec/rack_test_spec.rb @@ -7,7 +7,7 @@ module TestSessions RackTest = Capybara::Session.new(:rack_test, TestApp) end -Capybara::SpecHelper.run_specs TestSessions::RackTest, "RackTest", capybara_skip: %i[ +skipped_tests = %i[ js modals screenshot @@ -18,8 +18,9 @@ Capybara::SpecHelper.run_specs TestSessions::RackTest, "RackTest", capybara_skip hover about_scheme ] +Capybara::SpecHelper.run_specs TestSessions::RackTest, "RackTest", capybara_skip: skipped_tests -RSpec.describe Capybara::Session do +RSpec.describe Capybara::Session, capybara_skip: skipped_tests do include_examples Capybara::RSpecMatchers, TestSessions::RackTest, :rack_test context 'with rack test driver' do diff --git a/spec/rspec/shared_spec_matchers.rb b/spec/rspec/shared_spec_matchers.rb index 29f2ef99..9d8d4650 100644 --- a/spec/rspec/shared_spec_matchers.rb +++ b/spec/rspec/shared_spec_matchers.rb @@ -547,7 +547,7 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode| end.to raise_error('expected "with_js" to include "No such title"') end - context 'with wait' do + context 'with wait', requires: [:js] do before(:each) do @session = session @session.visit('/with_js') @@ -592,7 +592,7 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode| end.to raise_error('expected "/with_js" to equal "/not_with_js"') end - context 'with wait' do + context 'with wait', requires: [:js] do before(:each) do @session = session @session.visit('/with_js') @@ -840,7 +840,7 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode| end end - context "compounding", requires: [:js] do + context "compounding timing", requires: [:js] do before(:each) do @session = session @session.visit('/with_js') @@ -848,7 +848,7 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode| end context "#and" do - it "should run 'concurrently'" do + it "should run 'concurrently'", requires: [:js] do Capybara.using_wait_time(2) do matcher = have_text('this is not there').and have_text('neither is this') expect(Benchmark.realtime do @@ -859,7 +859,7 @@ RSpec.shared_examples Capybara::RSpecMatchers do |session, _mode| end end - it "should run 'concurrently' and retry" do + it "should run 'concurrently' and retry", requires: [:js] do @session.click_link('reload-link') @session.using_wait_time(2) do expect(Benchmark.realtime do