rails version:rails 4.2.5.2
test_helper.rb中:
- 1 ENV['RAILS_ENV'] ||= 'test'
| 2 require File.expand_path('../../config/environment', __FILE__)
| 3 require 'rails/test_help'
| 4
- 5 # use minitest report
| 6 require 'minitest/reporters'
| 7 Minitest::Reporters.use!
| 8
- 9 class ActiveSupport::TestCase
| 10 # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
| 11 fixtures :all
| 12
- 13 # Add more helper methods to be used by all tests here...
| 14 end
当我运行" rails g controller HomePages"
create app/controllers/home_pages_controller.rb
invoke erb
create app/views/home_pages
invoke test_unit
create test/controllers/home_pages_controller_test.rb
invoke helper
create app/helpers/home_pages_helper.rb
invoke test_unit
invoke assets
invoke coffee
create app/assets/javascripts/home_pages.coffee
invoke scss
create app/assets/stylesheets/home_pages.scss
显然,它没有自动生成辅助单元测试。
所以,我必须自己创建这个文件。
我该如何解决这个问题?谢谢。