Module: ActionView::TestCase::Behavior::Locals

Defined in:
actionpack/lib/action_view/test_case.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#localsObject

Returns the value of attribute locals



156
157
158
# File 'actionpack/lib/action_view/test_case.rb', line 156

def locals
  @locals
end

Instance Method Details

#render(options = {}, local_assigns = {}) ⇒ Object



158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'actionpack/lib/action_view/test_case.rb', line 158

def render(options = {}, local_assigns = {})
  case options
  when Hash
    if block_given?
      locals[options[:layout]] = options[:locals]
    elsif options.key?(:partial)
      locals[options[:partial]] = options[:locals]
    end
  else
    locals[options] = local_assigns
  end

  super
end