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!