Thanks for your reply Myron - I'd like to boot rspec just once. I tried using the global ordering technique, but it looks to me like it is called once per spec file, populating the 'list' argument with the list of example groups in that file.
I'm interested in reordering the list of files to be run, not the example groups within a file. Is there a way to reorder files? On Thursday, February 26, 2015 at 1:08:59 PM UTC-8, Myron Marston wrote: > > 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/a26c04df-88e4-4b25-94d3-b67cd9742e0f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
