making two requests to the same controller in rails integrations specs

后端 未结 5 2055
鱼传尺愫
鱼传尺愫 2021-02-12 19:17

I\'m having problem making two requests to the same url in a rails integration test, with rspec

it \'does something\' do

  # get \'/something\', {:status=>\'         


        
5条回答
  •  Happy的楠姐
    2021-02-12 19:38

    With plain old Rails test suite, functional tests are for single request and if you want to test flows you should use integration tests (you can reset the controller in functional tests).

    Controller specs from rspec-rails inherit from Rails functional tests, so they have same limitation. You can use rspec with capybara or webrat (I recommend the former) for integration tests.

    Also, recent versions of rspec-rails has "request specs" which "mix in behaivour of Rails integration tests": https://github.com/rspec/rspec-rails

提交回复
热议问题