Class: ViewSpec::Renderable

Inherits:
Object
  • Object
show all
Defined in:
lib/view_spec/renderable.rb

Defined Under Namespace

Classes: CurrentTemplate

Instance Method Summary collapse

Constructor Details

#initialize(identifier, executable, assigns: {}) ⇒ Renderable

Returns a new instance of Renderable.



9
10
11
12
13
# File 'lib/view_spec/renderable.rb', line 9

def initialize(identifier, executable, assigns: {})
  @identifier = identifier
  @executable = executable
  @assigns = assigns
end

Instance Method Details

#render_in(view_context) ⇒ Object



15
16
17
# File 'lib/view_spec/renderable.rb', line 15

def render_in(view_context)
  render_context(view_context).instance_exec(&@executable)&.strip&.html_safe
end