Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bundle exec rake test does nothing

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
like image 998
dennismonsewicz Avatar asked Jan 16 '13 16:01

dennismonsewicz


2 Answers

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
like image 133
dennismonsewicz Avatar answered Sep 30 '22 01:09

dennismonsewicz


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
like image 23
user160917 Avatar answered Sep 29 '22 23:09

user160917