Forum: RSpec Drawing the line between controller and integration tests

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
40a3939023ef722e64e4c255d6d5bcd9?d=identicon&s=25 Fearless Fool (fearless_fool)
on 2012-09-10 23:51
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 #{} 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!
40a3939023ef722e64e4c255d6d5bcd9?d=identicon&s=25 Fearless Fool (fearless_fool)
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.
This topic is locked and can not be replied to.