diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-29 20:00:10 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-30 00:18:57 -0300 |
commit | 7d17cd2cbfc086f5aa9dd636e1207eb130150428 (patch) | |
tree | 5fa391252294de8ab1eecdbe18f3afa1a9d813e0 /actionpack/lib/action_controller | |
parent | c2a7084a2df375e2a608767c6079a8d82a783620 (diff) | |
download | rails-7d17cd2cbfc086f5aa9dd636e1207eb130150428.tar.gz rails-7d17cd2cbfc086f5aa9dd636e1207eb130150428.tar.bz2 rails-7d17cd2cbfc086f5aa9dd636e1207eb130150428.zip |
Merge pull request #7659 from HugoLnx/template_error_no_matches_rebased
REBASED: fixing assert_template bug when template matches expected, but not ends with
Conflicts:
actionpack/CHANGELOG.md
actionpack/lib/action_controller/test_case.rb
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 717e4043bb..aa90f2899c 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -72,19 +72,26 @@ module ActionController validate_request! case options - when NilClass, String, Symbol + when NilClass, Regexp, String, Symbol options = options.to_s if Symbol === options rendered = @templates msg = build_message(message, "expecting <?> but rendering with <?>", options, rendered.keys.join(', ')) - assert_block(msg) do - if options + matches_template = + case options + when String + rendered.any? do |t, num| + options_splited = options.split(File::SEPARATOR) + t_splited = t.split(File::SEPARATOR) + t_splited.last(options_splited.size) == options_splited + end + when Regexp rendered.any? { |t,num| t.match(options) } - else - @templates.blank? + when NilClass + rendered.blank? end - end + assert matches_template, msg when Hash if expected_layout = options[:layout] msg = build_message(message, |