On Thursday, February 26, 2015 at 7:48:52 AM UTC-8, AndyL wrote:
>
> My unit/models specs run in a couple seconds, but my integration/feature 
> specs take minutes.
>
> I'd like to always run the fast specs before the slow specs.
>
> I try some test cases:
>
>     rspec models/spec1_spec.rb features/spec2_spec.rb
>     rspec features/spec2_spec.rb models/spec1_spec.rb
>
> and discover that the features always run before the models.  
>
> It seems that rspec sorts the specs by path name before running.
>
> Is there any way to force Rspec to run my model specs before the feature 
> specs?
>

The simplest way is to just do:

`rspec models && rspec features` to run one followed by the other.  If you 
want to boot RSpec only once, you can use RSpec's ordering API to order 
your specs arbitrarily:

http://rspec.info/documentation/3.2/rspec-core/RSpec/Core/Configuration.html#register_ordering-instance_method
https://relishapp.com/rspec/rspec-core/v/3-2/docs/configuration/overriding-global-ordering

RSpec.configure do |config|
  config.register_ordering(:global) do |list|
    # put logic in here to order model specs before feature specs
  end
end

HTH,
Myron

 

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/46de11fb-09af-4e08-87b4-0ec91f99c204%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to