我需要测试我与MINITEST控制器。 我试过了:
describe 'CommentsController' do
it "should get index" do
get :index
assert_response :success
end
end
和
class CommentsControllerTest < MiniTest::Unit::TestCase
def test_should_get_index
get :index
assert_response :success
end
end
但我有“未定义的方法'得到'”错误
您应该添加MINITEST护栏宝石,下面的文档中列出的步骤。 然后你的测试应该是这样的:
require "minitest_helper"
describe CommentsController do
it "should get index" do
get :index
assert_response :success
end
end
或者说,是这样的:
require "minitest_helper"
class CommentsControllerTest < MiniTest::Rails::ActionController::TestCase
test "should get index" do
get :index
assert_response :success
end
end