Ruby 使用Minitest测试葡萄-从哪个类继承?

Ruby 使用Minitest测试葡萄-从哪个类继承?,ruby,minitest,grape,grape-api,Ruby,Minitest,Grape,Grape Api,我的rails应用程序正在使用minitest。我不清楚我应该为我的测试继承什么类。我在想ActionController::TestCase,但这似乎不对,因为它没有连接到rails控制器。有什么建议吗 编辑: 无法使用MiniTest::Unit::TestCase,因为它不包含任何测试单个api端点的内容。我没有从特定的MiniTest类继承,而是包含了来自Rack的测试帮助程序 class V0::YourAPI < ActiveSupport::TestCase includ

我的rails应用程序正在使用minitest。我不清楚我应该为我的测试继承什么类。我在想ActionController::TestCase,但这似乎不对,因为它没有连接到rails控制器。有什么建议吗

编辑:
无法使用
MiniTest::Unit::TestCase
,因为它不包含任何测试单个api端点的内容。

我没有从特定的MiniTest类继承,而是包含了来自Rack的测试帮助程序

class V0::YourAPI < ActiveSupport::TestCase
  include Rack::Test::Methods

  def app
    Rails.application
  end
end
classv0::YourAPI
我没有从特定的minitest类继承,而是从Rack中包含了测试助手

class V0::YourAPI < ActiveSupport::TestCase
  include Rack::Test::Methods

  def app
    Rails.application
  end
end
classv0::YourAPI
我正在使用
ActionDispatch::IntegrationTest

例如:

class ApiRequestTest < ActionDispatch::IntegrationTest
 test "sample response" do
  get "/api/v1/sample_request"
  assert_equal response.success?, true
  assert_equal response.code, 200
 end
end
class APIRestTest
我正在使用
ActionDispatch::IntegrationTest

例如:

class ApiRequestTest < ActionDispatch::IntegrationTest
 test "sample response" do
  get "/api/v1/sample_request"
  assert_equal response.success?, true
  assert_equal response.code, 200
 end
end
class APIRestTest
我花了30秒的时间在谷歌上搜索“minitest”,看起来答案应该是
minitest::Unit::TestCase
?对不起,如果我听起来像是在屈尊俯就,我不是故意的。“api端点”是什么意思?Grape是Ruby创建HTTP api的库。您可以在一定程度上将其集成到rails中。编写测试时,需要在HTTP端点上使用GET、POST。TestCase为您提供了一个get方法来调用控制器和操作,但在这种情况下不起作用。我正在寻找要从中继承的内容,以便获得get/post方法和任何其他HTTP帮助程序。也许可以尝试从
Minitest::Unit::TestCase
include
ing
ActiveSupport::TestCase::Behavior::ClassMethods
中继承?这是个不错的主意。我试试看。我花了30秒的时间在谷歌上搜索“迷你测试”,结果看起来应该是
minitest::Unit::TestCase
?对不起,如果我对你说的是屈尊俯就,我不是故意的。“api端点”是什么意思?Grape是Ruby创建HTTP api的库。您可以在一定程度上将其集成到rails中。编写测试时,需要在HTTP端点上使用GET、POST。TestCase为您提供了一个get方法来调用控制器和操作,但在这种情况下不起作用。我正在寻找要从中继承的内容,以便获得get/post方法和任何其他HTTP帮助程序。也许可以尝试从
Minitest::Unit::TestCase
include
ing
ActiveSupport::TestCase::Behavior::ClassMethods
中继承?这是个不错的主意。我要试一试。