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-29 20:00:10 -0700 |
commit | d0d02bffe8dd12dcb2d113a60a6790d7a88e78be (patch) | |
tree | c0d1fba0790252e074c4a1c11f9dacd5eacc8ac5 /actionpack/lib/action_controller | |
parent | f655108c260ccd334e494b7d6da8822b31cc2156 (diff) | |
parent | 19dff78d0202303f7559921f24b9801722695f33 (diff) | |
download | rails-d0d02bffe8dd12dcb2d113a60a6790d7a88e78be.tar.gz rails-d0d02bffe8dd12dcb2d113a60a6790d7a88e78be.tar.bz2 rails-d0d02bffe8dd12dcb2d113a60a6790d7a88e78be.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
Diffstat (limited to 'actionpack/lib/action_controller')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index 0caeef3192..34974f5149 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -86,16 +86,23 @@ module ActionController response.body case options - when NilClass, String, Symbol, Regexp + when NilClass, Regexp, String, Symbol options = options.to_s if Symbol === options rendered = @templates msg = message || sprintf("expecting <%s> but rendering with <%s>", options.inspect, rendered.keys) - matches_template = - 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 assert matches_template, msg when Hash |