rspec & devise test helpers

后端 未结 4 1410

According to this from the devise wiki I should be able to use a login_user helper method in my controller tests. Accordingly I have the following within the spec directory:

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-15 06:31

    I imagine there are a couple of problems with this approach. First is that you're using request specs, not controller specs, so the login_user method is not made available by config.extend ControllerMacros, :type => :controller. Second, even if you are able to include the method it most likely won't work anyway, since the Devise test helpers are specifically written for controller/view tests, not integration tests.

    Take a look at David Chelimsky's answer to this SO question, which may be of help.

提交回复
热议问题