CheeseFry
CheeseFry

Reputation: 1319

How to run only controller tests in MiniTest?

What is the rake command for running only controller tests in minitest? rake test:controller doesn't do the trick.

Upvotes: 4

Views: 2737

Answers (3)

CheeseFry
CheeseFry

Reputation: 1319

As an update:

rails test path/to/test/file.rb has become my go-to solution.
rails test path/to/test/file.rb:123 lets you pick the test via line number as well.

Upvotes: 1

miligraf
miligraf

Reputation: 1072

Has to be plural rake test:controllers as you're running all of them.

Please take a look at http://guides.rubyonrails.org/testing.html#rake-tasks-for-running-your-tests for more rake commands.

If you want to run a specific file, then use the TEST argument:

rake test TEST=test/controllers/application_controller_test.rb

Upvotes: 6

Harry Zumwalt
Harry Zumwalt

Reputation: 132

Try making it plural. This is the typical command:

rake test:controllers

http://guides.rubyonrails.org/testing.html#rake-tasks-for-running-your-tests

Section 6 covers the rake commands for testing.

Upvotes: 8

Related Questions