[rspec-users] db:test:prepare interfering with rake spec pattern
dchelimsky at gmail.com
Sat Mar 5 10:21:06 EST 2011
On Mar 4, 2011, at 9:53 PM, Mario Aquino wrote:
> I have a tricky problem with running rake spec in a Rails 3.0.3
> project (using rspec-2.5.0, rspec-rails and rake 0.8.7). It may be
> that this mailing list is not the correct one to ask for help, but I
> am hoping that it is. When I run 'rake spec', the spec files for one
> of the gems my project uses are executed in addition to the spec files
> for my own project. I want to restrict the spec files that the rake
> task runs so that only my own project specs are executed because there
> is a conflict (from factory_girl) that gets triggered by the inclusion
> of the specs from one of my gem dependencies.
> I have created a custom rake task that calls the rspec rake task as
> require 'rake'
> require 'rspec/core/rake_task'
> namespace :spec do
> desc "Run specs without invoking bundler"
> RSpec::Core::RakeTask.new('nob' => 'db:test:prepare') do |t|
> t.pattern = ['spec/**/*_spec.rb', 'vendor/engines/proposals/spec/**/*_spec.rb']
> t.skip_bundler = true
> My task declares a dependency on the 'db:test:prepare' task. When the
> db:test:prepare task runs, somehow the pattern that gets set by my
> task is ignored
What happens if you remove that dependency and run:
> and instead specs from one of the gems my project
> depends on are executed in addition to my own project gems and this is
> a big problem for me. I would like to trigger the db setup-related
> activities that normally run before my specs execute. I haven't been
> able to figure out what is causing the 'pattern' I am declaring to be
> ignored when db:test:prepare runs, but something is definitely
> resetting the pattern (when I run my task without the
> 'db:test:prepare' dependency, only the specs from my project are
> Any assistance would be appreciated.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users