I'm trying to write a controller spec for a simple controller. However, Capybara isn't seeing any page content. However, looking at the site's pages in my browser works just fine. What am I doing wrong?
T. Hanks!
I'm trying to write a controller spec for a simple controller. However, Capybara isn't seeing any page content. However, looking at the site's pages in my browser works just fine. What am I doing wrong?
T. Hanks!
You need to explicitly tell your controller spec that you want it to render views in order for this to work. Update your spec to look like this:
This is described in rspec's readme. For a more detailed view, see rspec-rails' cucumber feature for 'render_views'.
Just one word of caution with this. There are reasons why this isn't default behaviour:
spec/integration
rather thanspec/controller
.... Not saying you shouldn't do this, just saying you should be clear why you are.
Hope that helps.