I'm trying to understand what belongs -- and what doesn't belong -- in
controller tests and in integration tests.
As a common example, assume I have a list of named widgets. Somewhere
in my code, I want to verify that
widget = FactoryGirl.create(:widget)
get :index
generates a page that has the string #{widget.name} somewhere therein.
But is that a controller test or an integration test?
As another example, assume a user must be logged on in order to access
the widgets. I can test authentication and authorization separately,
but is it considered necessary to write an integration test for this?
Or is this something you'd verify in a controller test?
Etc. I'm not looking for specific answers to the above as much as
guiding principles, or at least pointers to same. Thanks!
on 2012-09-10 23:51
on 2012-09-11 00:28
One addendum: One thing I'd specifically like to know is where/how do you test the *contents* of generated responses? That seems beyond the purview of a controller test, but it doesn't require multiple transactions or cross-controller interactions that would require an integration test.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.