Search code examples
ruby-on-railstestingrakeminitest

Why is my minitest.rake running twice when I enter rake into terminal?


I created a minitest.rake, as per ryan bates railscast (http://railscasts.com/episodes/327-minitest-with-rails).

When I run rake in the terminal, the test runs, and then runs again before resetting the command line.

require "rake/testtask"

Rake::TestTask.new(:test => "db:test:prepare") do |t|
  t.libs << "test"
  t.pattern = "test/**/*_test.rb"
end

task default: :test

Solution

  • I'd suppose you already have a task with such a name defined. If you define a new task with the same name it is appended to already existing one.

    What if you remove or comment out this code and do rake -T, will test task be there?