In Rails 5, the team changed controller tests to effectively be integration 
tests (use URLs instead of actions), don’t test controller instance variables, 
don’t test what template is rendered, etc. Instead, you should test the 
contents of the page for specifics that indicate the request completed as 
expected.

With RSpec (at least with 3.1), controller tests in Rails 5 are still based on 
the old unit test (Test::Case). So I’m wondering where I should go here?

It should be noted that I’m just "passing through” Rails 5 on my way to Rails 6 
(or at least 5.2), as that may affect the answer to my question.

Here are some of the alternatives I can think of:

1) Stay with current software, use the "rails-controller-testing” to restore 
template and assigns testing, and leave it alone for a future release.

2) Stay with current software, rewrite all of the controller specs as request 
specs (and abandon the controller specs).

3) Upgrade to a newer version of RSpec that treats controller specs as request 
specs (does this even exist?) and rework the controller specs to follow the 
rules of request specs.


There are a couple questions that inform this answer, and perhaps deserve to be 
answered in their own right:

1) When all is said and done, what is the position of the RSpec team regarding 
controller specs vs. request specs?

2) Since it seems that, for at least awhile, RSpec and Rails were a bit at odds 
regarding the nature of these tests, what minor versions of RSpec 3 align with 
(are intended to be used with) which versions of Rails 5?


It seems to me that these are relatively fundamental questions, and most 
probably have been discussed/debated at great length, so if you can point me to 
such a discussion that describes the official opinion of the RSpec team (if 
there is one), that would be great. (I don’t need someone to write all that up 
again if it already exists! I’ve seen a lot of blogs giving people’s opinoins 
on controller unit specs vs. request specs vs. feature specs and I don’t really 
want to touch the request spec vs. feature spec argument here.)

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/EE4FD491-213D-426B-9CD6-4C059AB8A897%40pobox.com.

Reply via email to