<commit_before>require 'minitest/autorun'
require_relative '../../../lib/Sandbox/Application'

describe Sandbox::Application do

  before do
    @application = Sandbox::Application.new
  end

  it 'Invokes before-chain methods in order before Resource methods' do

    class BeforeChain
      include Sandbox::Resource::Stateless
      include Sandbox::Resource::Chains

      chain_before :all, -> (request) { request[:test] << 1 }
      chain_before :all, -> (request) { request[:test] << 2 }
      chain_before :get, -> (request) { request[:test] << 3 }
      chain_before :get, -> (request) { request[:test] << 4 }

      def get(request)
        request[:test] << 5
      end
    end

    request = { test: [] }<commit_msg>Improve chaining spec.<commit_after>require 'minitest/autorun'
require_relative '../../../lib/Sandbox/Application'

describe Sandbox::Application do

  before do
    @application = Sandbox::Application.new
  end

  it 'Invokes before-chain methods in order before Resource methods' do

    class BeforeChain
      include Sandbox::Resource::Stateless
      include Sandbox::Resource::Chains

      chain_before :all, -> (request) { request[:test] << 1 }
      chain_before :get, -> (request) { request[:test] << 3 }
      chain_before :all, -> (request) { request[:test] << 2 }
      chain_before :get, -> (request) { request[:test] << 4 }

      def get(request)
        request[:test] << 5
      end
    end

    request = { test: [] }
{'fraction_non_alphanumeric': 0.13993174061433447, 'fraction_numerical': 0.006825938566552901, 'mean_word_length': 3.0274725274725274, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 11, 'https://': 0, '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': '1877844', 'n_tokens_mistral': 448, 'n_tokens_neox': 424, 'n_words': 114}