diff --git a/lib/capybara/rspec.rb b/lib/capybara/rspec.rb index cba5009d7..b9a20bb8b 100644 --- a/lib/capybara/rspec.rb +++ b/lib/capybara/rspec.rb @@ -5,6 +5,7 @@ require 'capybara/rspec/features' RSpec.configure do |config| + config.expose_dsl_globally = false if config.respond_to? :expose_dsl_globally config.include Capybara::DSL, :type => :feature config.include Capybara::RSpecMatchers, :type => :feature diff --git a/lib/capybara/rspec/features.rb b/lib/capybara/rspec/features.rb index bb5e1e17b..53bce4073 100644 --- a/lib/capybara/rspec/features.rb +++ b/lib/capybara/rspec/features.rb @@ -21,7 +21,8 @@ def self.feature(*args, &block) options[:caller] ||= caller args.push(options) - describe(*args, &block) + #call describe on RSpec in case user has expose_dsl_globally set to false + RSpec.describe(*args, &block) end RSpec.configuration.include Capybara::Features, :capybara_feature => true diff --git a/lib/capybara/spec/spec_helper.rb b/lib/capybara/spec/spec_helper.rb index 4addb3e4b..4f4701e4f 100644 --- a/lib/capybara/spec/spec_helper.rb +++ b/lib/capybara/spec/spec_helper.rb @@ -52,7 +52,7 @@ def spec(name, options={}, &block) def run_specs(session, name, options={}) specs = @specs - describe Capybara::Session, name, options do + RSpec.describe Capybara::Session, name, options do include Capybara::SpecHelper before do @session = session diff --git a/spec/basic_node_spec.rb b/spec/basic_node_spec.rb index d86b9a14c..878b82d46 100644 --- a/spec/basic_node_spec.rb +++ b/spec/basic_node_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Capybara do +RSpec.describe Capybara do describe '.string' do let :string do Capybara.string <<-STRING diff --git a/spec/capybara_spec.rb b/spec/capybara_spec.rb index 5cbd5d010..811bcf3f9 100644 --- a/spec/capybara_spec.rb +++ b/spec/capybara_spec.rb @@ -1,7 +1,6 @@ require 'spec_helper' -describe Capybara do - +RSpec.describe Capybara do describe 'default_wait_time' do after do Capybara.default_wait_time = @previous_default_time @@ -44,7 +43,7 @@ end end -describe Capybara::Session do +RSpec.describe Capybara::Session do context 'with non-existant driver' do it "should raise an error" do expect { diff --git a/spec/dsl_spec.rb b/spec/dsl_spec.rb index 2d924c436..ec024ac1b 100644 --- a/spec/dsl_spec.rb +++ b/spec/dsl_spec.rb @@ -14,7 +14,7 @@ class TestClass :hover ] -describe Capybara::DSL do +RSpec.describe Capybara::DSL do after do Capybara.session_name = nil Capybara.default_driver = nil diff --git a/spec/fixtures/selenium_driver_rspec_failure.rb b/spec/fixtures/selenium_driver_rspec_failure.rb index 80b6ead3f..2ec124ab7 100644 --- a/spec/fixtures/selenium_driver_rspec_failure.rb +++ b/spec/fixtures/selenium_driver_rspec_failure.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Capybara::Selenium::Driver do +RSpec.describe Capybara::Selenium::Driver do it "should exit with a non-zero exit status" do browser = Capybara::Selenium::Driver.new(TestApp).browser expect(true).to eq(false) diff --git a/spec/fixtures/selenium_driver_rspec_success.rb b/spec/fixtures/selenium_driver_rspec_success.rb index c9b74513b..1f5f96726 100644 --- a/spec/fixtures/selenium_driver_rspec_success.rb +++ b/spec/fixtures/selenium_driver_rspec_success.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Capybara::Selenium::Driver do +RSpec.describe Capybara::Selenium::Driver do it "should exit with a zero exit status" do browser = Capybara::Selenium::Driver.new(TestApp).browser expect(true).to eq(true) diff --git a/spec/rack_test_spec.rb b/spec/rack_test_spec.rb index 990e9f7e8..f5b07038b 100644 --- a/spec/rack_test_spec.rb +++ b/spec/rack_test_spec.rb @@ -13,7 +13,7 @@ module TestSessions :hover ] -describe Capybara::Session do +RSpec.describe Capybara::Session do context 'with rack test driver' do before do @session = TestSessions::RackTest @@ -70,7 +70,7 @@ module TestSessions end end -describe Capybara::RackTest::Driver do +RSpec.describe Capybara::RackTest::Driver do before do @driver = TestSessions::RackTest.driver end @@ -165,7 +165,7 @@ def dont_extend_css_handler end include CSSHandlerIncludeTester -describe Capybara::RackTest::CSSHandlers do +RSpec.describe Capybara::RackTest::CSSHandlers do it "should not be extended by global includes" do expect(Capybara::RackTest::CSSHandlers.new).not_to respond_to(:dont_extend_css_handler) end diff --git a/spec/result_spec.rb b/spec/result_spec.rb index 4c4fb1221..9f14c5c61 100644 --- a/spec/result_spec.rb +++ b/spec/result_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Capybara::Result do +RSpec.describe Capybara::Result do let :string do Capybara.string <<-STRING