title: how to write a custom rake task for RSpec?
body: <p>In my Rake file:</p>
  
  <pre><code>require 'rspec/core/rake_task'
  
  desc 'Default: run specs.'
  task :default =&gt; :spec
  
  desc "Run specs"
  RSpec::Core::RakeTask.new do |task|
      task.pattern = "**/spec/*_spec.rb"
      task.rspec_opts = Dir.glob("[0-9][0-9][0-9]_*").collect { |x| "-I#{x}" }.sort
      task.rspec_opts &lt;&lt; '-r ./rspec_config'
      task.rspec_opts &lt;&lt; '--color'
      task.rspec_opts &lt;&lt; '-f documentation'
  end
  </code></pre>
  
  <p>In rspec_config.rb</p>
  
  <pre><code>RSpec.configure {|c| c.fail_fast = true}
  </code></pre>
  
  <p>My file structure:</p>
  
  <pre><code>|-- 001_hello
  |   |-- hello1.rb
  |   `-- spec
  |       `-- hello_spec.rb
  |-- 002_hello
  |   |-- hello2.rb
  |   `-- spec
  |       `-- hello_spec.rb
  |-- 003_hello
  |   |-- hello3.rb
  |   `-- spec
  |       `-- hello_spec.rb
  |-- Rakefile
  `-- rspec_config.rb
  </code></pre>
  
  <p>when rake task will run it will do the operation sequentially on the above file structure.
  How to ensure that if '001_hello' fails then it should not run '002_hello'?</p>
  
  <p>Currently it run on reverse order ie. '003_hello' then '002_hello' then '001_hello'.</p>