When I run rspec
localy all specs pass.
When I run all specs in Docker or CI, they fail. However, when I run them in isolation, they pass. Another thing to mention is that every time I have different set of specs failing.
Environment setup:
ruby 2.2.2
rails 4.2.0
postgres 9.3
(using ActiveRecord)
gems:
database_cleaner 1.4.1
fabrication 2.14.0
faker 1.4.3
The problem may be with database_cleaner
settings.
# database_cleaner.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with(:deletion)
Rake::Task["create_mailers"].invoke
end
config.around(:each) do |example|
DatabaseCleaner.strategy = example.metadata[:js] ? :deletion: :transaction
DatabaseCleaner.cleaning do
example.run
end
end
config.after(:each) do
Capybara.reset_sessions!
DatabaseCleaner.clean
end
end
So my question is, how do I make my tests pass in Docker and CI?