class SimpleCells::SpecHelper

Attributes

action_name[R]
body[R]
cell_class_name[R]
cell_name[R]
simple_cell_arguments[R]

Public Class Methods

new(cell_name, action_name, simple_cell_arguments = {}) click to toggle source
# File lib/simple_cells/spec_helper.rb, line 4
def initialize(cell_name, action_name, simple_cell_arguments = {})
  @action_name = action_name
  @cell_name = cell_name
  @cell_class_name = "#{cell_name.to_s.camelize}SimpleCell"
  @simple_cell_arguments = simple_cell_arguments
  render
end

Public Instance Methods

cell_instance() click to toggle source
# File lib/simple_cells/spec_helper.rb, line 12
def cell_instance
  @cell_instance ||= cell_class_name.constantize.new(view_context: view_context, simple_cell_arguments: simple_cell_arguments)
end
controller() click to toggle source
# File lib/simple_cells/spec_helper.rb, line 16
def controller
  @controller ||= ActionController::Base.new
end
render() click to toggle source
# File lib/simple_cells/spec_helper.rb, line 20
def render
  cell_instance.__send__(action_name)
  @body = cell_instance.render_simple_cell_view(cell_name, action_name)
end
view_context() click to toggle source
# File lib/simple_cells/spec_helper.rb, line 25
def view_context
  @view_context ||= controller.view_context
end