From b1ba333ea72b8aa8fc5ffeda4067c128afb026e4 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Wed, 2 Jul 2014 15:36:23 -0700 Subject: Fix assert_template for files. The test was not failing for `assert_template file: nil` when a file has been rendered. --- actionpack/lib/action_controller/test_case.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index eb5d824cbc..152420a54c 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -91,6 +91,13 @@ module ActionController # # assert that no partials were rendered # assert_template partial: false # + # # assert that a file was rendered + # assert_template file: "README.rdoc" + # + # # assert that no file was rendered + # assert_template file: nil + # assert_template file: false + # # In a view test case, you can also assert that specific locals are passed # to partials: # @@ -140,6 +147,8 @@ module ActionController if options[:file] assert_includes @_files.keys, options[:file] + elsif options.key?(:file) + assert @_files.blank?, "expected no files but #{@_files.keys} was rendered" end if expected_partial = options[:partial] -- cgit v1.2.3