ruby-on-rails – Rail3 rake测试任务未运行测试
发布时间:2020-12-17 03:58:26 所属栏目:百科 来源:网络整理
导读:我有一个非常类似的问题到 Mr. Limpens,有一个主要的不同:我确实将test_unit railtie包含在我的application.rb中. 从我的application.rb: require File.expand_path('../boot',__FILE__)# Pick the frameworks you want: require 'action_controller/railt
我有一个非常类似的问题到
Mr. Limpens,有一个主要的不同:我确实将test_unit railtie包含在我的application.rb中.
从我的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) 你会注意到我正在使用DataMapper并使用dm-rails bootstrap初始化我的项目.我可以手动运行我的测试,如下所示: $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 但是在执行rake测试任务时,没有运行测试,如下所示: $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 每个运行’first_time’显示在括号中.我的测试没有运行,我必须做错什么? 解决方法
我认为rake测试任务是搜索匹配test / unit / ** / * _ test.rb等名称的测试文件.所以你可能只需要将文件名test_habit.rb更改为habit_test.rb.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |