diff --git a/lib/capybara/rspec.rb b/lib/capybara/rspec.rb index 1a917654..36b7ae49 100644 --- a/lib/capybara/rspec.rb +++ b/lib/capybara/rspec.rb @@ -15,7 +15,7 @@ RSpec.configure do |config| Capybara.use_default_driver end end - config.before do + config.before do |example| if self.class.include?(Capybara::DSL) Capybara.current_driver = Capybara.javascript_driver if example.metadata[:js] Capybara.current_driver = example.metadata[:driver] if example.metadata[:driver] diff --git a/spec/rspec/features_spec.rb b/spec/rspec/features_spec.rb index ee23bff4..6690eed4 100644 --- a/spec/rspec/features_spec.rb +++ b/spec/rspec/features_spec.rb @@ -15,7 +15,7 @@ feature "Capybara's feature DSL" do page.should have_content('Hello world!') end - scenario "preserves description" do + scenario "preserves description" do |example| example.metadata[:full_description].should == "Capybara's feature DSL preserves description" end @@ -41,11 +41,11 @@ feature "Capybara's feature DSL" do page.should have_content 'Hello world!' end - scenario 'are marked in the metadata as capybara_feature' do + scenario 'are marked in the metadata as capybara_feature' do |example| example.metadata[:capybara_feature].should be_true end - scenario 'have a type of :feature' do + scenario 'have a type of :feature' do |example| example.metadata[:type].should eq :feature end end