Sha256: 2fccbcfc65104c5707b31bb7a7a9e734da1bcc5bab58b23e89271574271762fc

Contents?: true

Size: 798 Bytes

Versions: 1

Compression:

Stored size: 798 Bytes

Contents

require 'draper/test/view_context'

module Draper
  module DecoratorExampleGroup
    extend ActiveSupport::Concern
    included { metadata[:type] = :decorator }
  end
end

RSpec.configure do |config|
  # Automatically tag specs in specs/decorators as type: :decorator
  config.include Draper::DecoratorExampleGroup, :type => :decorator, :example_group => {
    :file_path => /spec[\\\/]decorators/
  }

  # Specs tagged type: :decorator set the Draper view context
  config.before :type => :decorator do
    Draper::ViewContext.infect!(self)
  end

  config.before :type => :view do
    controller.set_current_view_context
  end
end

if defined?(Capybara)
  require 'capybara/rspec/matchers'

  RSpec.configure do |config|
    config.include Capybara::RSpecMatchers, :type => :decorator
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
draper-0.15.0 lib/draper/test/rspec_integration.rb