我们如何在控制器集成测试rspec/or中发送AJAX请求



我在rspec控制器测试中发送AJAX请求,如以下

it 'responds with success' do
  xhr :get, :index, delivery_method: :deliver, status: :pending, format: 'js'
  expect(response.status).to eq(200)
end

但我不知道如何在Integration测试中发送相同的请求。

我们可以像
一样简单地发送请求

 xhr 'get','[path_to_action]', delivery_method: :deliver, status: :pending, format: 'js'

这里CCD_ 2是rails请求助手方法。

相关内容

最新更新