123456789_123456789_123456789_123456789_123456789_

Module: RSpec::Rails::ViewAssigns

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: rspec-rails/lib/rspec/rails/view_assigns.rb

Overview

Helpers for making instance variables available to views.

Instance Method Summary

Instance Method Details

#_encapsulated_assigns (private)

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/view_assigns.rb', line 22

def _encapsulated_assigns
  @_encapsulated_assigns ||= {}
end

#assign(key, value)

Assigns a value to an instance variable in the scope of the view being rendered.

Examples:

assign(:widget, stub_model(Widget))
[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/view_assigns.rb', line 11

def assign(key, value)
  _encapsulated_assigns[key] = value
end

#view_assigns

Compat-shim for AbstractController::Rendering#view_assigns

[ GitHub ]

  
# File 'rspec-rails/lib/rspec/rails/view_assigns.rb', line 16

def view_assigns
  super.merge(_encapsulated_assigns)
end