Rail3 Rail Test Fails

I have a very similar problem to Mr. Limpens , with one big difference: I include raitie test_unit in my .rb application.

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 will notice that I am using DataMapper and initialized my project using dm-rails bootstrap. I can run my tests manually, for example:

  $ 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 performing the rake verification task, tests are not executed, for example:

  $ 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 start of "first_time" is displayed in parentheses. What should I do wrong that my tests fail?

+4
source share
1 answer

I think that rake test tasks are looking for test files matching names, for example test / unit / ** / * _ test.rb. Therefore, you just need to change the file name test_habit.rb to habit_test.rb.

+11
source

All Articles