Make Rspec 3 compliant

Change explicit use of `example` variable to using the block value that
is passed in to examples and before/after hooks.
This commit is contained in:
Thomas Holmes 2013-07-20 14:09:51 -04:00
parent 61524b0fd3
commit 2a95252f8a
2 changed files with 6 additions and 6 deletions

View File

@ -15,10 +15,10 @@ 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]
Capybara.current_driver = Capybara.javascript_driver if ex.metadata[:js]
ampleCapybara.current_driver = ex.metadata[:driver] if ex.metadata[:driver]
end
end
end

View File

@ -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