Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6559199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:17:40+00:00 2026-05-25T13:17:40+00:00

In my Rake file: require ‘rspec/core/rake_task’ desc ‘Default: run specs.’ task :default => :spec

  • 0

In my Rake file:

require 'rspec/core/rake_task'

desc 'Default: run specs.'
task :default => :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 << '-r ./rspec_config'
    task.rspec_opts << '--color'
    task.rspec_opts << '-f documentation'
end

In rspec_config.rb

RSpec.configure {|c| c.fail_fast = true}

My file structure:

|-- 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

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’?

Currently it run on reverse order ie. ‘003_hello’ then ‘002_hello’ then ‘001_hello’.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T13:17:40+00:00Added an answer on May 25, 2026 at 1:17 pm

    You need to modify the task pattern to get files to run in a particular order. For instance:

    RSpec::Core::RakeTask.new do |task|
      task.pattern = Dir['[0-9][0-9][0-9]_*/spec/*_spec.rb'].sort
      task.rspec_opts = Dir.glob("[0-9][0-9][0-9]_*").collect { |x| "-I#{x}" }
      task.rspec_opts << '-r ./rspec_config --color -f d'
    end
    

    This will run all files matching ###_*/spec/*_spec.rb in alphabetical order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rakefile that looks like this: require 'rspec/core/rake_task' desc Run all RSpec
I have a rake task I need to run as a daily job on
I have a rake task that performs a shell command. When I run it
I am using rubygem delayed job but not able to run rake task successfully.
When running: rake spec:models everything works well, but when I do rspec spec/models/spot_spec.rb that
I'm trying to use Factory Girl in a rake task like this: require 'factory_girl'
I have a Rakefile with a Rake task that I would normally call from
Is there a rake task for backing up the data in your database? I
I'm writing a rake task that does some DB work outside of Rails/ActiveRecord. Is
When I run rake gems:build with hpricot 0.6.164 on my FreeBSD server I get:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.