Swinger is not being maintained anymore. Capybara can do RSpec driver swapping out of the box now. :)
Swinger is a really simple Capybara extension that aims to make driver switching in RSpec a bit less horrible to look at. Using the new metadata feature in RSpec 2, you can simply set your :driver
per scenario or context:
it 'should give a nice greeting', :driver => :selenium do
visit homepage
page.should have_content 'Welcome'
end
context 'when logged in', :driver => :rack_test do
it 'should get a nice greeting' do
visit homepage
page.should have_content 'Welcome back'
end
it 'should show the logout link' do
visit homepage
page.should have_content 'Logout'
end
end
It also adds the using_driver
method to Capybara, allowing you to execute a block using a specific driver. This is especially useful when you’re (still) not on RSpec 2 and can’t use the new metadata feature:
it 'should give a nice greeting' do
Capybara.using_driver :selenium do
visit homepage
page.should have_content 'Welcome'
end
end
Installing Swinger is easy. Simply add it to your Gemfile
and require it in spec_helper.rb
(or acceptance_helper.rb
if you’re using Steak).
Found an issue? Have a great idea? Want to help? Great! Create an issue issue for it, ask, or even better; fork the project and fix the problem yourself. Pull requests are always welcome. :)