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



151
152
153
# File 'actionpack/lib/action_view/test_case.rb', line 151

def locals
  @locals
end

Instance Method Details

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



153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'actionpack/lib/action_view/test_case.rb', line 153

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