0

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?

Pav31
  • 540
  • 7
  • 19
  • Hey man, what i can tell is that you use DatabaseCleaner.cleaning OR DatabaseCleaner.clean, not both. At least thats what the docs are telling. Maybe you can sort that out and report back. – jfornoff Sep 22 '15 at 12:14
  • @jfornoff, thanks for response! Unfortunately this didn't solve the issue. – Pav31 Sep 22 '15 at 14:58
  • Can you share more info? Are there any error messages? – mycargus Feb 20 '17 at 04:07

0 Answers0