Sha256: 8e5dd7ad1272166860176bafba18b5188c713211c444a2e853c59907ac64f1a8

Contents?: true

Size: 622 Bytes

Versions: 3

Compression:

Stored size: 622 Bytes

Contents

module Draper
  module DecoratorExampleGroup
    extend ActiveSupport::Concern
    included { metadata[:type] = :decorator }
  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.around do |example|
      if :decorator == example.metadata[:type]
        ApplicationController.new.set_current_view_context
      end
      example.call
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
draper-0.11.1 lib/draper/rspec_integration.rb
draper-0.11.0 lib/draper/rspec_integration.rb
draper-0.10.0 lib/draper/rspec_integration.rb