Class: SimpleCells::SpecHelper
- Inherits:
-
Object
- Object
- SimpleCells::SpecHelper
- Defined in:
- lib/simple_cells/spec_helper.rb
Instance Attribute Summary collapse
-
#action_name ⇒ Object
readonly
Returns the value of attribute action_name.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#cell_class_name ⇒ Object
readonly
Returns the value of attribute cell_class_name.
-
#cell_name ⇒ Object
readonly
Returns the value of attribute cell_name.
-
#simple_cell_arguments ⇒ Object
readonly
Returns the value of attribute simple_cell_arguments.
Instance Method Summary collapse
- #cell_instance ⇒ Object
- #controller ⇒ Object
-
#initialize(cell_name, action_name, simple_cell_arguments = {}) ⇒ SpecHelper
constructor
A new instance of SpecHelper.
- #render ⇒ Object
- #view_context ⇒ Object
Constructor Details
#initialize(cell_name, action_name, simple_cell_arguments = {}) ⇒ SpecHelper
Returns a new instance of SpecHelper.
4 5 6 7 8 9 10 |
# 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 |
Instance Attribute Details
#action_name ⇒ Object (readonly)
Returns the value of attribute action_name.
2 3 4 |
# File 'lib/simple_cells/spec_helper.rb', line 2 def action_name @action_name end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
2 3 4 |
# File 'lib/simple_cells/spec_helper.rb', line 2 def body @body end |
#cell_class_name ⇒ Object (readonly)
Returns the value of attribute cell_class_name.
2 3 4 |
# File 'lib/simple_cells/spec_helper.rb', line 2 def cell_class_name @cell_class_name end |
#cell_name ⇒ Object (readonly)
Returns the value of attribute cell_name.
2 3 4 |
# File 'lib/simple_cells/spec_helper.rb', line 2 def cell_name @cell_name end |
#simple_cell_arguments ⇒ Object (readonly)
Returns the value of attribute simple_cell_arguments.
2 3 4 |
# File 'lib/simple_cells/spec_helper.rb', line 2 def simple_cell_arguments @simple_cell_arguments end |
Instance Method Details
#cell_instance ⇒ Object
12 13 14 |
# 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 ⇒ Object
16 17 18 |
# File 'lib/simple_cells/spec_helper.rb', line 16 def controller @controller ||= ActionController::Base.new end |
#render ⇒ Object
20 21 22 23 |
# 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 ⇒ Object
25 26 27 |
# File 'lib/simple_cells/spec_helper.rb', line 25 def view_context @view_context ||= controller.view_context end |