Created
May 27, 2011 00:02
-
-
Save nahurst/994387 to your computer and use it in GitHub Desktop.
Selenium, rspec, capybara integration with steak to make it like cucumber when cleaning the database javascript tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/acceptance/support/javascript.rb | |
RSpec.configure do |config| | |
config.use_transactional_fixtures = false | |
config.before :each do | |
Capybara.current_driver = :selenium if example.metadata[:js] | |
if Capybara.current_driver == :rack_test | |
DatabaseCleaner.strategy = :transaction | |
else | |
DatabaseCleaner.strategy = :truncation | |
end | |
DatabaseCleaner.start | |
end | |
config.after do | |
DatabaseCleaner.clean | |
Capybara.use_default_driver if example.metadata[:js] | |
end | |
end | |
# in the feature file | |
feature "..." %q{ | |
... | |
} do | |
scenario "...", :js => true do | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment