lib/action_view/component/test_helpers.rb in actionview-component-1.10.0 vs lib/action_view/component/test_helpers.rb in actionview-component-1.11.0
- old
+ new
@@ -1,11 +1,21 @@
# frozen_string_literal: true
+require "capybara/minitest"
+
module ActionView
module Component
module TestHelpers
+ include Capybara::Minitest::Assertions
+
+ def page
+ Capybara::Node::Simple.new(@raw)
+ end
+
def render_inline(component, **args, &block)
- Nokogiri::HTML.fragment(controller.view_context.render(component, args, &block))
+ @raw = controller.view_context.render(component, args, &block)
+
+ Nokogiri::HTML.fragment(@raw)
end
def controller
@controller ||= Base.test_controller.constantize.new.tap { |c| c.request = request }.extend(Rails.application.routes.url_helpers)
end