<commit_before># backports https://github.com/jcasimir/draper/pull/87

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

  RSpec.configure do |config|
    # Automatically tag spec 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<commit_msg>draper: backported workaround at https://github.com/jcasimir/draper/issues/60<commit_after># backports https://github.com/jcasimir/draper/pull/87
# and https://github.com/jcasimir/draper/issues/60 workaround

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

  RSpec.configure do |config|
    # Automatically tag spec 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]
        controller = ApplicationController.new
        controller.request = ActionDispatch::TestRequest.new
        controller.set_current_view_context
      end
      example.call
    end
  end
end
{'fraction_non_alphanumeric': 0.09345794392523364, 'fraction_numerical': 0.004984423676012461, 'mean_word_length': 3.4985994397759104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7126414', 'n_tokens_mistral': 497, 'n_tokens_neox': 468, 'n_words': 114}