测试一个 controller 时ActionDispatch::IntegrationTest
中有以下的 case:
test "should success when received a request for javascript response" do
get ajax_sample_path, headers: { "HTTP_ACCEPT" => "application/javascript" }
assert_response :success
end
如果直接跑会报 402,但如果在相应的 controller 里加一句skip_before_action :verify_authenticity_token
,测试就过了。
那么有可能在ActionDispatch::IntegrationTest
中跳过verify_authenticity_token
么?