Closed derekprior closed 13 years ago
Yes, good idea. Feel free to make a pull request. Thanks.
When I run all, I specifically do not want --drb
to be specified as I do when I run my spec files individually. I need this for various reasons, not the least of which is that Factory Girl and Spork don't work well when run in a drb situation.
If the 'each run' options were concatenated onto the run_all
options, there'd be no way to disable drb in the context.
So I'm pretty sure this is not a good idea.
The Guardfile is just Ruby, there's no reason you can't do:
common_run_options = '--drb --format d'
guard 'rspec', :cli => common_run_options, :run_all => { :cli => "--tag ~js #{common_run_options}" }
Fair enough, but could you explain why you don't want --drb
on run_all
but want it on run_on_change
(since I guess you're using FactoryGirl in both contexts)?
I've come to agree with @jfelchner. I think merging the options would validate the principle of least surprise. I'm going to close this.
That said, FactorGirl and Spork work just fine for me. Add gem 'factory_girl_rails', :require => false
to your gem file. Then add require 'factory_girl_rails'
to your spork each_run block. This reloads the factories every run. I don't have a huge library of factories, but I havent noticed any slowdown from this.
Yep, same for us, we require 'factory_girl'
though (but I think it does the same under the hood...).
Trust me guys, I've looked up every Spork/RSpec/FactoryGirl combo online. :) Literally 3 dozen at least. Nothing works properly for me. I always get the dreaded expected Object (#somenumber) but got Object (#someothernumber)
Using the require => false
trick, I can get it to work just fine for everything except my acceptance tests. So when I have a passing unit test and I want it to run all specs (which includes my acceptance tests as well), it can't use the drb server or they'll fail.
Are you using mongoid
or devise
too? You can trap class method with Jujutsu Spork technique :)
Spork.prefork do
require "rails/mongoid"
Spork.trap_class_method(Rails::Mongoid, :load_models)
require "rails/application"
Spork.trap_method(Rails::Application, :reload_routes!)
Spork.trap_method(Rails::Application::RoutesReloader, :reload!)
# ....
end
I have guard configured with the option:
:cli => "--drb --format d"
. When running all my specs, I want to exclude those that use selenium with:run_all => { :cli => "--tag ~js" }
. This works, but requires I re-specify my original :cli options as well.It'd be nice if the cli options were merged.