Sha256: d800c8c58b4622d264588413a07c32841399d2414caa595eea3fc407b966c8e4

Contents?: true

Size: 724 Bytes

Versions: 3

Compression:

Stored size: 724 Bytes

Contents

# frozen_string_literal: true

module ActionView
  module Component
    module TestHelpers
      def render_inline(component, **args, &block)
        Nokogiri::HTML(controller.view_context.render(component, args, &block))
      end

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

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

      def render_component(component, **args, &block)
        ActiveSupport::Deprecation.warn(
          "`render_component` has been deprecated in favor of `render_inline`, and will be removed in v2.0.0."
        )

        render_inline(component, args, &block)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
actionview-component-1.3.6 lib/action_view/component/test_helpers.rb
actionview-component-1.3.5 lib/action_view/component/test_helpers.rb
actionview-component-1.3.4 lib/action_view/component/test_helpers.rb