How to do integration testing with RSpec and Devise/CanCan?

前端 未结 6 678
情书的邮戳
情书的邮戳 2020-12-04 08:43

If I have a Devise model User, of which only those users with role :admin are allowed to view a certain url, how can I write an RSpec integration test to check that the stat

6条回答
  •  不思量自难忘°
    2020-12-04 09:46

    Ah, so close. This does the trick - I was missing the proper parameter form, and the redirecting.

    post_via_redirect user_session_path, 'user[email]' => user.email, 'user[password]' => user.password
    

提交回复
热议问题