Search code examples
ruby-on-railsrubycapybaraminitestrake-test

Rake Default namespace runs tests


I'm attempting to run some tests on my rails application, and they're working, which is great. However, I'm noticing that when I just run rake it defaults to running my tests. If anybody has run into this before and can shed some light on why this is happening, I'd appreciate it.

I'm using

  • rails 4.1.0
  • ruby 2.0.0
  • factory girl rails
  • minitest rails
  • minitest rails capybara
  • database cleaner

Rakefile

require File.expand_path('../config/application', __FILE__)

Pinteresting::Application.load_tasks

namespace :test do
  task :run do
    ENV["RACK_ENV"] = "test"
    $LOAD_PATH.unshift("lib", "spec")
    if ARGV[1]
      require_relative ARGV[1]
    else
      Dir.glob("./spec/**/*_spec.rb").each { |file| require file }
    end
  end
end

Solution

  • The default rake task is defined in rails/railties/Rakefile, and it runs all unit tests by default.

    enter image description here