Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rail3 rake test task not running tests

I have a very similar problem to Mr. Limpens, with one major different: I do include the test_unit railtie into my application.rb.

From my application.rb:

require File.expand_path('../boot', __FILE__)

# Pick the frameworks you want:                                                                                                                                
require 'action_controller/railtie'
require 'dm-rails/railtie'
# require 'action_mailer/railtie'                                                                                                                              
# require 'active_resource/railtie'                                                                                                                            
require 'rails/test_unit/railtie'

# If you have a Gemfile, require the gems listed there, including any gems                                                                                     
# you've limited to :test, :development, or :production.                                                                                                       
Bundler.require(:default, Rails.env) if defined?(Bundler)

You'll note that I am using DataMapper and initialized my project with the dm-rails bootstrap. I may run my tests manually, like so:

$ ruby -Itest test/unit/test_habit.rb 
Loaded suite test/unit/test_habit
Started
.....
Finished in 2.554523 seconds.

5 tests, 7 assertions, 0 failures, 0 errors, 0 skips

Test run options: --seed 15947

but when executing the rake test task no tests are run, like so:

$ rake test --trace
(in /home/blt/Documents/projects/rails3apps/naughtyapp)
** Invoke test (first_time)
** Execute test
** Invoke test:units (first_time)
** Invoke test:prepare (first_time)
** Execute test:prepare
** Execute test:units
** Invoke test:functionals (first_time)
** Invoke test:prepare 
** Execute test:functionals
** Invoke test:integration (first_time)
** Invoke test:prepare 
** Execute test:integration

Each run 'first_time' is displayed in parenthesis. What must I be doing wrong that my tests don't run?

like image 350
troutwine Avatar asked Dec 16 '22 20:12

troutwine


1 Answers

I think that the rake test tasks are searching for test files matching names like test/unit/**/*_test.rb. So you may just need to change the filename test_habit.rb to habit_test.rb.

like image 160
Steve Avatar answered Dec 31 '22 19:12

Steve