I spent a significant amount of time trying to work out why I couldn't use the declarative style for defining tests in Rails and MiniTest. Given the following test definition (with default test_helper.rb):
require 'test_helper' class FooTest < ActiveSupport::TestCase test "foo" do end end
I kept getting:
mbp4:myapp mike.campbell$ rake test:models rake aborted! unknown command 'f' /Users/mike.campbell/projects/myapp/test/models/student_test.rb:4:in `test' ...
The letter was whatever the first letter of my test description was. It was clear the `test` method wasn't being defined correctly, but I couldn't figure out why, until I looked at the method definition:
unless defined?(Spec) def test(name, &block) # ... end end
Ack, the method wasn't being defined because Spec was defined. Indeed, I had rspec-rails in my bundle. I find it kind of odd that Rails would make such a check, but never-the-less, mystery solved.