I am trying to get my heads "dirty" with TDD and for some reason when I run bundle exec rake test
on the command line, nothing happens.
Here is my RakeFile
:
require 'rake/testtask'
Rake::TestTask.new do |test|
test.libs << 'test'
end
desc "Run Tests"
task :default => :test
Here is my test file:
require 'test/unit'
class TestMygem < Test::Unit::TestCase
def test_silly_example
assert_equal 2+2, 5
end
end
I forgot to add this line to my RakeFile
test.test_files = FileList['tests/test_*.rb']
So, all in all, here is my final RakeFile
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'test'
test.test_files = FileList['tests/test_*.rb']
end
desc "Run Tests"
task :default => :test
As of Rails 3.2.20, the following is acceptable
require 'rake/testtask'
Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.pattern = 'test/_test*.rb'
t.verbose = false # or true
end
desc "Run Tests"
task :default => :test
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With