From c21ab338cb9e38a0bfa51ac8cf4d70285f03c7b2 Mon Sep 17 00:00:00 2001 From: Yves Senn Date: Sat, 15 Dec 2012 20:20:34 +0100 Subject: descriptive `assert_template` error when partial wasn't rendered When `assert_template` is used with the :locals option, and the partial was not rendered, a method_missing error was raised. This changes first checks, if the partial actually was rendered and raises a descriptive error. --- actionpack/lib/action_view/test_case.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionpack/lib/action_view/test_case.rb') diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index 4479da5bc4..1f89e51c66 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -134,6 +134,10 @@ module ActionView @rendered_views[view] end + def rendered_views + @rendered_views.keys + end + def view_rendered?(view, expected_locals) locals_for(view).any? do |actual_locals| expected_locals.all? {|key, value| value == actual_locals[key] } -- cgit v1.2.3