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 9100131
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:47:30+00:00 2026-06-17T00:47:30+00:00

I have a bunch of tests that aren’t unit or functional tests, they’re of

  • 0

I have a bunch of tests that aren’t unit or functional tests, they’re of the format test/foo/special_test.rb

I want to create a rake task like rake test:units that will run all the tests in the foo folder. How do I do this?

Edit: I’d actually like rake test:foo to be a little different from rake test:units, in that I do not want it to run when I do simply rake test.

  • 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-06-17T00:47:31+00:00Added an answer on June 17, 2026 at 12:47 am

    I don’t remember where this is from, so unfortunately I can’t give proper acknowledgement, but this should work. I say “should” because I’ve stopped using it, but grabbed it from my git history.

    # First, 'reopen' the default :test namespace and create your custom task.
    namespace :test do
      Rake::TestTask.new(:foo_tests => ["test:prepare", "other_dependent_rake_tasks"] ) do |t|
        DatabaseCleaner.strategy = :transaction # If using this.
    
        t.libs << "test"
        # Will also get subfolders within test/foo
        t.test_files = FileList['test/foo/**/*_test.rb', 'test/foo/*_test.rb']
      end
    end
    

    You can remove the default “test” task and redefine it so that when you run rake test it will automatically also run rake test:foo_tests.

    remove_task "test"
    
    desc 'Adding onto Rails regular tests'
    task :test do
      # Add all the names of tests you want run here.
      errors = %w(test:units test:functionals test:integration test:foo_tests).collect do |task|
        begin
          puts "Running: #{task}"
          Rake::Task[task].invoke
          nil
        rescue => e
          task
        end
      end.compact
      abort "Errors running #{errors * ', '}!" if errors.any?
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of unit tests that need to be conditional compiled based
I have a bunch of c# tests that I want to run through a
I have a bunch of unit tests that work on a class which executes
I have a bunch of unit tests that I'm running in batch mode. Occasionally,
I have a bunch of unit tests (Test1, Test2, etc.), but rather than having
I have a set of unit tests, each with a bunch of methods, each
I have a bunch of tests that assume that my Tetris class is composed
I have a bunch of .net nunit tests that need to be run on
I have a bunch of unit tests in my visual studio project and code
Background: In our project, we have a bunch of xml files that define tests

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.