diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-30 23:51:10 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-10-30 23:52:51 -0200 |
commit | 6b7cd20ab39b16cb5111ecca71ffea4fd95a0066 (patch) | |
tree | b8e8ea36f1fe78e01c95caf68d541f273922e243 /actionpack/lib | |
parent | 37c60c91f3224baea579fca1df7a580d85ec143f (diff) | |
download | rails-6b7cd20ab39b16cb5111ecca71ffea4fd95a0066.tar.gz rails-6b7cd20ab39b16cb5111ecca71ffea4fd95a0066.tar.bz2 rails-6b7cd20ab39b16cb5111ecca71ffea4fd95a0066.zip |
Revert "Merge pull request #7797 from senny/7459_prefix_tempalte_assertion_variables"
This reverts commit 2bad605873b5b720d77ae6388a995827ab7fe705.
Conflicts:
actionpack/CHANGELOG.md
Reason: This added a regression related with shoulda-matchers, since it
is expecting the instance variable @layouts
See https://github.com/thoughtbot/shoulda-matchers/blob/9e1188eea68c47d9a56ce6280e45027da6187ab1/lib/shoulda/matchers/action_controller/render_with_layout_matcher.rb#L74
This will introduce back #7459 but this stable release will be backward compatible.
Related with #8068.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/test_case.rb | 40 | ||||
-rw-r--r-- | actionpack/lib/action_view/test_case.rb | 6 |
2 files changed, 23 insertions, 23 deletions
diff --git a/actionpack/lib/action_controller/test_case.rb b/actionpack/lib/action_controller/test_case.rb index d486f32c01..37470b8713 100644 --- a/actionpack/lib/action_controller/test_case.rb +++ b/actionpack/lib/action_controller/test_case.rb @@ -14,13 +14,13 @@ module ActionController end def setup_subscriptions - @_partials = Hash.new(0) - @_templates = Hash.new(0) - @_layouts = Hash.new(0) + @partials = Hash.new(0) + @templates = Hash.new(0) + @layouts = Hash.new(0) ActiveSupport::Notifications.subscribe("render_template.action_view") do |name, start, finish, id, payload| path = payload[:layout] - @_layouts[path] += 1 + @layouts[path] += 1 end ActiveSupport::Notifications.subscribe("!render_template.action_view") do |name, start, finish, id, payload| @@ -28,11 +28,11 @@ module ActionController next unless path partial = path =~ /^.*\/_[^\/]*$/ if partial - @_partials[path] += 1 - @_partials[path.split("/").last] += 1 - @_templates[path] += 1 + @partials[path] += 1 + @partials[path.split("/").last] += 1 + @templates[path] += 1 else - @_templates[path] += 1 + @templates[path] += 1 end end end @@ -43,9 +43,9 @@ module ActionController end def process(*args) - @_partials = Hash.new(0) - @_templates = Hash.new(0) - @_layouts = Hash.new(0) + @partials = Hash.new(0) + @templates = Hash.new(0) + @layouts = Hash.new(0) super end @@ -74,7 +74,7 @@ module ActionController case options when NilClass, Regexp, String, Symbol options = options.to_s if Symbol === options - rendered = @_templates + rendered = @templates msg = build_message(message, "expecting <?> but rendering with <?>", options, rendered.keys.join(', ')) @@ -96,15 +96,15 @@ module ActionController if expected_layout = options[:layout] msg = build_message(message, "expecting layout <?> but action rendered <?>", - expected_layout, @_layouts.keys) + expected_layout, @layouts.keys) case expected_layout when String - assert(@_layouts.keys.include?(expected_layout), msg) + assert(@layouts.keys.include?(expected_layout), msg) when Regexp - assert(@_layouts.keys.any? {|l| l =~ expected_layout }, msg) + assert(@layouts.keys.any? {|l| l =~ expected_layout }, msg) when nil - assert(@_layouts.empty?, msg) + assert(@layouts.empty?, msg) end end @@ -119,7 +119,7 @@ module ActionController warn "the :locals option to #assert_template is only supported in a ActionView::TestCase" end elsif expected_count = options[:count] - actual_count = @_partials[expected_partial] + actual_count = @partials[expected_partial] msg = build_message(message, "expecting ? to be rendered ? time(s) but rendered ? time(s)", expected_partial, expected_count, actual_count) @@ -127,11 +127,11 @@ module ActionController else msg = build_message(message, "expecting partial <?> but action rendered <?>", - options[:partial], @_partials.keys) - assert(@_partials.include?(expected_partial), msg) + options[:partial], @partials.keys) + assert(@partials.include?(expected_partial), msg) end else - assert @_partials.empty?, + assert @partials.empty?, "Expected no partials to be rendered" end end diff --git a/actionpack/lib/action_view/test_case.rb b/actionpack/lib/action_view/test_case.rb index dfaa1d88e4..658a503f7f 100644 --- a/actionpack/lib/action_view/test_case.rb +++ b/actionpack/lib/action_view/test_case.rb @@ -193,16 +193,16 @@ module ActionView @_result @_routes @controller - @_layouts + @layouts @locals @method_name @output_buffer - @_partials + @partials @passed @rendered @request @routes - @_templates + @templates @options @test_passed @view |