Class: ViewSpec::Renderable
- Inherits:
-
Object
- Object
- ViewSpec::Renderable
- Defined in:
- lib/view_spec/renderable.rb
Defined Under Namespace
Classes: CurrentTemplate
Instance Method Summary collapse
-
#initialize(identifier, tpl = nil, &block) ⇒ Renderable
constructor
A new instance of Renderable.
- #render_in(view_context) ⇒ Object
Constructor Details
#initialize(identifier, tpl = nil, &block) ⇒ Renderable
Returns a new instance of Renderable.
7 8 9 10 |
# File 'lib/view_spec/renderable.rb', line 7 def initialize(identifier, tpl = nil, &block) @identifier = identifier @block = tpl ? -> { render inline: tpl } : block end |
Instance Method Details
#render_in(view_context) ⇒ Object
12 13 14 |
# File 'lib/view_spec/renderable.rb', line 12 def render_in(view_context) render_context(view_context).instance_exec(&@block)&.strip&.html_safe end |