This is a fairly common question, and there isn't a One True Answer.
These are the most common techniques:
# WAIT! Do consider that `wait` may not be needed. This article describes | |
# that reasoning. Please read it and make informed decisions. | |
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/ | |
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations? | |
describe 'Modal' do | |
should 'display login errors' do | |
visit root_path |
RSpec.configure do |config| | |
config.before(:suite) do | |
ActiveRecord::Base.establish_connection database['one'] | |
DatabaseCleaner.strategy = :deletion | |
ActiveRecord::Base.establish_connection config.database['two'] | |
DatabaseCleaner.strategy = :deletion | |
end | |
config.before(:each) do |
# Gemfile | |
… | |
gem 'uuidtools' | |
… |
There is something to be learned from a rainstorm. | |
When meeting with a sudden shower, you try | |
not to get wet and run quickly along the road. | |
By doing such things as passing under the eaves | |
of houses, you still get wet. When you are | |
resolved from the beginning, you will not be | |
perplexed, though you will still get the same | |
soaking. This understanding extends to all things. | |
Ghost Dog, Chapter 22, T01:32:25 (quoted from: Hagakure: The Book of the Samauri) |