grosser / parallel_tests

Ruby: 2 CPUs = 2x Testing Speed for RSpec, Test::Unit and Cucumber
3.37k stars 494 forks source link

Uninitialized constant Shoulda & DatabaseCleaner #774

Closed ig-martinez closed 4 years ago

ig-martinez commented 4 years ago

Hi, I'm trying to use the gem in my test suite, where I'm also using ShouldaMatchers and DatabaseCleaner, but after having installed parallel_tests whenever I run rake parallel:spec I get these:

  Shoulda::Matchers.configure do |config|
    config.integrate do |with|
      with.test_framework :rspec
      with.library :rails
    end
  end

NameError:
  uninitialized constant Shoulda
# ./spec/rails_helper.rb:13:in `<top (required)>'
Failure/Error: DatabaseCleaner.clean_with(:truncation)

NameError:
  uninitialized constant DatabaseCleaner
# ./spec/support/database_cleaner.rb:3:in `block (2 levels) in <top (required)>'

Any ideas what could it be? Running rspec works just fine

grosser commented 4 years ago

run with --verbose then you will see which commands it runs under the hood, then run these commands and see what their problem is (most likely a missing require)

ig-martinez commented 4 years ago

Thanks for the quick reply.

Unfortunately rake parallel:spec --verbose gave me the exact same output, no additional information

grosser commented 4 years ago

use parallel_rspec for more control over the arguments

ig-martinez commented 4 years ago

Surprisingly, using parallel_rspec made the tests run ¯_(ツ)_/¯

grosser commented 4 years ago

sounds like rake tasks sets the RAILS_ENV env var then ?

ig-martinez commented 4 years ago

Sounds like. Anyways, I can work with parallel_rspec. Thanks for the help