I'm new to rspec and fairly new to rails. When writing test cases for controllers I've noticed render_views
used often. What does this do and what happens if I don't call it?
it renders the view's in the controller spec. If you don't put render_views, the views won't render, that means the controller is called but after it returns the views are not rendered. Controller tests will run faster, as they won't have to render the view, but you might miss bugs in the view.
It's about isolation. The idea is that you don't want your controller specs failing because there is a syntax error in the view, which should cause a request spec or a view spec to fail. If you're not writing request specs or view specs, or Cucumber features, then render_views
can help you from a test-coverage perspective.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With