class ActionView::TestCase::Behavior::RenderedViewsCollection - actionview-4.2.3 Documentation

# class ActionView::TestCase::Behavior::RenderedViewsCollection

Need to experiment if this priority is the best one: rendered => output_buffer

### Public Class Methods

new() click to toggle source

    # File lib/action_view/test_case.rb, line 130
    def initialize
      @rendered_views ||= Hash.new { |hash, key| hash[key] = [] }
    end

### Public Instance Methods

add(view, locals) click to toggle source

    # File lib/action_view/test_case.rb, line 134
    def add(view, locals)
      @rendered_views[view] ||= []
      @rendered_views[view] << locals
    end

locals_for(view) click to toggle source

    # File lib/action_view/test_case.rb, line 139
    def locals_for(view)
      @rendered_views[view]
    end

rendered_views() click to toggle source

    # File lib/action_view/test_case.rb, line 143
    def rendered_views
      @rendered_views.keys
    end

view_rendered?(view, expected_locals) click to toggle source

    # File lib/action_view/test_case.rb, line 147
    def view_rendered?(view, expected_locals)
      locals_for(view).any? do |actual_locals|
        expected_locals.all? {|key, value| value == actual_locals[key] }
      end
    end