So I just started learning testing this week, when I scaffold something, Rails generates a lot of things in /spec folder. Some of them are clear, while the other remains gray to me even after Googling for two days. To name my confusions:
Controllers: unit test or functional test? Or put in another word, does it get to touch real model or stubbed one?
Controllers: do I test authentication or authorization paths, given that I unit tested policies (authorization rules)? Or should I just stub them out and only test normal cases (authenticated and authorized ones)?
Views: do I test them? Iāve been told both do and do-not, whatās the benefit or necessity?
Requests: is this where I put my integration tests? Do I need to test every corner case, coz it is a lot considering authentication and authorization even for simplest CRUD resources.
Features: so I guess I only test some major usage paths here right? Whatās the boundary between feature tests and integration test?
Dying to clear my head out now, really appreciate your options!
Rails 4 Test Prescriptions by Rappin - This is a bit more higher level and less syntax-oriented and goes into principles/guidelines (e.g., what to test in a model, what makes great tests). Iām currently reading this and finding it to be a great read.