diff options
author | Yves Senn <yves.senn@gmail.com> | 2012-12-15 20:21:40 +0100 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2013-02-04 14:46:50 +0100 |
commit | cce94e7232fdd53d5212d85b6f6ecc411baa0b16 (patch) | |
tree | 917af7c7434d28e0efa626648708b16a7e4fb71c /actionpack/test/template | |
parent | c21ab338cb9e38a0bfa51ac8cf4d70285f03c7b2 (diff) | |
download | rails-cce94e7232fdd53d5212d85b6f6ecc411baa0b16.tar.gz rails-cce94e7232fdd53d5212d85b6f6ecc411baa0b16.tar.bz2 rails-cce94e7232fdd53d5212d85b6f6ecc411baa0b16.zip |
partials inside directory work with `assert_template`
previously when a partial was placed inside a directory
(eg. '/dir/_partial'), `assert_template` did not replace
the '_' prefix when looking through rendered tempaltes,
which resulted in an error.
I modified it to replace both, the leading '_' and the last '_'
after a '/'.
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/test_case_test.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/template/test_case_test.rb b/actionpack/test/template/test_case_test.rb index c8441b6894..acd002ce73 100644 --- a/actionpack/test/template/test_case_test.rb +++ b/actionpack/test/template/test_case_test.rb @@ -338,6 +338,18 @@ module ActionView assert_match "i_was_never_rendered to be rendered but it was not.", e.message assert_match 'Expected ["/test/partial"] to include "i_was_never_rendered"', e.message end + + test 'specifying locals works when the partial is inside a directory with underline prefix' do + controller.controller_path = "test" + render(template: 'test/render_partial_inside_directory') + assert_template partial: 'test/_directory/_partial_with_locales', locals: { 'name' => 'Jane' } + end + + test 'specifying locals works when the partial is inside a directory without underline prefix' do + controller.controller_path = "test" + render(template: 'test/render_partial_inside_directory') + assert_template partial: 'test/_directory/partial_with_locales', locals: { 'name' => 'Jane' } + end end module AHelperWithInitialize |