So we have a variety of view specs in our project:
https://github.com/tansaku/LocalSupport/blob/master/spec/views/organizations/index.html.erb_spec.rb
but we are having trouble with testing javascript generated by the gmap4rails gem. I think I've tracked the issue down to the problem that the view specs don't appear to render the application layout.
We have a separate view spec for the application layout, which works, and that renders the application layout fine. However when we run view specs the application layout code is not getting rendered.
Any help on this much appreciated
I was just about to post this and then saw the second answer to How do I test the title of a page from an RSpec view spec? which is about a different problem, but allowed me to come up with the solution which is to explicitly render the layout in the spec:
render template: "organizations/index", layout: "layouts/application"
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