# How to control order of spec execution in "spec specs/\* "?

**URL:** <https://www.ruby-forum.com/t/how-to-control-order-of-spec-execution-in-spec-specs/132489>\
**Category:** Ruby\
**Created:** [March 20, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/how-to-control-order-of-spec-execution-in-spec-specs/132489 "2008-03-20T18:02:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aginghipster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e9c0ed/32.png) [@aginghipster](https://www.ruby-forum.com/u/aginghipster)\
**Post date:** [March 20, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/how-to-control-order-of-spec-execution-in-spec-specs/132489/1 "2008-03-20T18:02:13Z")

</div>

This is a rspec question.

I have many rspecs in a spec directory.

In the execution, I need some tests run before others. So I name the  
files as: 01\_deploy\_spec.rb, 02\_post\_process\_spec.rb

I want 01\* to be run before 02\*

I found that the default order in rspec is in the order of last file  
modification.

What are the ways to do it?

Thanks  
~Andrew C.

---

<div class="post-metadata">

**Author:** ![aginghipster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/e9c0ed/32.png) [@aginghipster](https://www.ruby-forum.com/u/aginghipster)\
**Post date:** [March 25, 2008, 1:36pm UTC](https://www.ruby-forum.com/t/how-to-control-order-of-spec-execution-in-spec-specs/132489/2 "2008-03-25T13:36:58Z")

</div>

On Thu, Mar 20, 2008 at 12:01 PM, Andrew C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> modification.  
> The default is actually alpha. mtime must be invoked explicitly. Do  
> you have mtime listed in spec/spec.opts? If so, get rid of it and you  
> should be OK.

Cheers,  
David
