When an exception is raised during rendering of a view it is wrapped inside an ActionView::Template::Error which is then reraised.
This leads to unhelpful failure messages in view specs, along the lines of
contact/index.html.haml renders a form to send feedback Failure/Error: it "renders a form to send feedback" do render ActionView::Template::Error # ./app/views/contact/index.html.haml:19 # ./spec/views/contact/index.html.haml_spec.rb:10:in `block (2 levels) in'
This little monkey patch
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
ensures that the original exception is the one that is displayed.