Flowdock
method

setup_subscriptions

Importance_0
Ruby on Rails latest stable (v4.2.1) - 0 notes - Class: ActionController::TemplateAssertions
setup_subscriptions() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionpack/lib/action_controller/test_case.rb, line 20
    def setup_subscriptions
      RENDER_TEMPLATE_INSTANCE_VARIABLES.each do |instance_variable|
        instance_variable_set("@_#{instance_variable}", Hash.new(0))
      end

      @_subscribers = []

      @_subscribers << ActiveSupport::Notifications.subscribe("render_template.action_view") do |_name, _start, _finish, _id, payload|
        path = payload[:layout]
        if path
          @_layouts[path] += 1
          if path =~ /^layouts\/(.*)/
            @_layouts[$1] += 1
          end
        end
      end

      @_subscribers << ActiveSupport::Notifications.subscribe("!render_template.action_view") do |_name, _start, _finish, _id, payload|
        if virtual_path = payload[:virtual_path]
          partial = virtual_path =~ /^.*\/_[^\/]*$/

          if partial
            @_partials[virtual_path] += 1
            @_partials[virtual_path.split("/").last] += 1
          end

          @_templates[virtual_path] += 1
        else
          path = payload[:identifier]
          if path
            @_files[path] += 1
            @_files[path.split("/").last] += 1
          end
        end
      end
    end
Register or log in to add new notes.