gpt4 book ai didi

ruby-on-rails - ActionController::TestCase 与 ActiveSupport::TestCase;究竟有什么区别?

转载 作者:行者123 更新时间:2023-12-04 05:59:11 25 4
gpt4 key购买 nike

我假设 ActionController::TestCase仅用于测试 ActionControllers ,但什么是 ActiveSupport::TestCase测试?它是否测试所有内容(模型、 View 和 Controller )?这些类(class)中的一个或两个是否过时/过时?我想我更喜欢坚持使用股票 RoR 测试方式,而不是与其他 gem 等混淆。我是 Ruby on Rails 和 TDD 的新手。

最佳答案

ActionController::TestCase 是为测试 Controller 而设计的,所以它有专门的测试 Controller 的方法。
ActiveSupport::TestCase 设计用于测试模型。
这些类有 api
http://api.rubyonrails.org/classes/ActionController/TestCase.html
http://api.rubyonrails.org/classes/ActiveSupport/TestCase.html

关于ruby-on-rails - ActionController::TestCase 与 ActiveSupport::TestCase;究竟有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8141957/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com