Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 在控制器集成测试rspec/ror中,我们如何发送AJAX请求?_Ruby On Rails_Ruby_Ajax_Ruby On Rails 4_Rspec - Fatal编程技术网

Ruby on rails 在控制器集成测试rspec/ror中,我们如何发送AJAX请求?

Ruby on rails 在控制器集成测试rspec/ror中,我们如何发送AJAX请求?,ruby-on-rails,ruby,ajax,ruby-on-rails-4,rspec,Ruby On Rails,Ruby,Ajax,Ruby On Rails 4,Rspec,我在rspec控制器测试中发送AJAX请求,如下所示 it 'responds with success' do xhr :get, :index, delivery_method: :deliver, status: :pending, format: 'js' expect(response.status).to eq(200) end 但是我不知道如何在集成测试中发送相同的请求。我们可以像 xhr 'get','[path_to_action]', delivery_metho

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

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

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

我们可以像

 xhr 'get','[path_to_action]', delivery_method: :deliver, status: :pending, format: 'js'
这里
xhr
是一个rails请求助手方法