I just wondering, how to test devise's controller with rspec?
With devise, we hand off most of users controller's action to devise, and maybe only a show action for users, and I write the user#show spec in spec/controllers/users_controller_spec.rb
, but what about the other actions supplied by devise, how to test them?
or, I just don't need to test the devise controller, 'cause it is been tested while develop the gem?
Personally I would not test devise itself. That's the responsibility of the author of that gem. What I would focus on is the behavior of your application instead. Isolate the devise code by mock/stub where necessary and only test your side of the points where your code intersects with the devise code.
That's not to say you can't write a few quick tests on critical behavior--log in for example.
You might consider reading The Rspec Book . I found it invaluable to getting my head into the BDD & Rspec mindset.
如果您想要一些示例,请使用Devise和RSpec和Cucumber查看Rails 3.1中的源代码。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.