Module: Frails::Component::TestHelpers

Defined in:
lib/frails/component/test_helpers.rb

Instance Method Summary collapse

Instance Method Details

#controllerObject



10
11
12
# File 'lib/frails/component/test_helpers.rb', line 10

def controller
  @controller ||= ApplicationController.new.tap { |c| c.request = request }
end

#render_inline(options = {}, locals = {}, &block) ⇒ Object



6
7
8
# File 'lib/frails/component/test_helpers.rb', line 6

def render_inline(options = {}, locals = {}, &block)
  Nokogiri::HTML(controller.view_context.render(options, locals, &block))
end

#requestObject



14
15
16
# File 'lib/frails/component/test_helpers.rb', line 14

def request
  @request ||= ActionDispatch::TestRequest.create
end