Sha256: 585f8ca84f6532ddc06b752dfbcdbdff548562eb2c13ecba591103a2be2e1714

Contents?: true

Size: 666 Bytes

Versions: 4

Compression:

Stored size: 666 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 = 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

4 entries across 4 versions & 1 rubygems

Version Path
actionview-component-1.3.3 lib/action_view/component/test_helpers.rb
actionview-component-1.3.2 lib/action_view/component/test_helpers.rb
actionview-component-1.3.1 lib/action_view/component/test_helpers.rb
actionview-component-1.3.0 lib/action_view/component/test_helpers.rb