I confused. What I should test in controller folder? Controller actions for returning success code? Why, if I can do it in integration test by one command?
And what for views test? To test if view has some html tags? I can do it in integration tests too.
Models need to test validation rules? Thanks for any help.
There are tests easier to implement in a controller spec.
An example:
Scenario:
One wants to test authorized access to a set of views (let us assume that non authorized users are to be redirected to a login page).
integration test approach:
This can be done testing the view, with integration tests, which tend to be slower to execute (visit login page, fill credential fields and press enter, visit page to test…)
controller test approach:
One can test each of controller’s methods and check the response code. Was the response a redirect? (code 200). Besides, since the methods in a controller are the entry point of a rails app, one can be positive that additional views are covered by the controller specs.