Sha256: d22376f977aef65ce9917cc0a5b7f3c87ebf1a6c833b1cf5ff9b5fe9e8fdcea2

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

module ViewComponentExampleGroup
  extend ActiveSupport::Concern
  include RSpec::Rails::RailsExampleGroup
  include ActionView::TestCase::Behavior
  include Capybara::RSpecMatchers

  included do
    attr_reader :rendered
  end

  def arbre(&block)
    Arbre::Context.new({}, _view, &block)
  end

  def helper
    _view
  end

  def render(builder_method, *args, &block)
    @rendered =
      if block_given?
        arbre(&block).to_s
      else
        arbre.send(builder_method, *args, &block)
      end
  end
end

RSpec.configure do |config|
  config.include(ViewComponentExampleGroup, type: :view_component)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cert_watch-1.1.0 spec/support/helpers/view_component_example_group.rb
cert_watch-1.0.0 spec/support/helpers/view_component_example_group.rb