test:prepare and the orm option. #794

Exoth opened this Issue Aug 1, 2013 · 5 comments

4 participants


There's already a solved issue #246 about using ActiveRecord and Mongoid together, but now there's another place in rspec-rails-2.14.0/lib/rspec/rails/tasks/rspec.rake with the same problem:

spec_prereq = Rails.configuration.generators.options[:rails][:orm] == :active_record ?  "test:prepare" : :noop

So test:prepare isn't being run if I use ActiveRecord with Mongoid and run 'rake spec'.

We just need to change this line to this:

spec_prereq = defined?(ActiveRecord) ?  "test:prepare" : :noop

I can do a pull request if you agree to such a fix.

RSpec member

@Exoth it's easiest to debug issues like this if we have a repo we can clone down and run against. Could you build a minimal example in 2 commits: 1 starting a new rails project with rspec and 1 adding the code to demonstrate the issue?


Well, it can be just a new project with mongoid added to the gemfile. That's all: test:prepare won't be run. Is it really required to show you a repo example?


Though here's a little clarification: test:prepare isn't being run when I'm doing rake spec. Updated the issue.

RSpec member

@Exoth it's a lot easier for us if we have a repo we can just clone to get a working problem, it eliminates guess work and allows us to focus on actually fixing the problem, alternatively you're welcome to have a go fixing this yourself and opening a PR :)

RSpec member

Closing as this is stale.

@cupakromer cupakromer closed this Apr 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment