在 Rails 4 的 test_helper
中使用 Minitest::Spec
和 ActiveSupport::TestCase
有什么区别?
最佳答案
This project aims to enable MiniTest within the Rails TestCase classes. Your test will continue to inherit from
ActiveSupport::TestCase
, which will now support the spec DSL. Minitest on Github
这意味着您不必使用 Minitest::Spec
,只需始终使用 ActiveSupport::TestCase
即可在代码中获得一些约定。
编辑:当您不使用 minitest-rails gem 时,您必须 register_spec_type
class ControllerSpec < MiniTest::Spec
end
# Functional tests = describe ***Controller
MiniTest::Spec.register_spec_type( /Controller$/, ControllerSpec )
关于ruby-on-rails - Minitest::Spec 和 ActiveSupport::TestCase 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21783012/