<commit_before>require 'spec_helper'

describe Configurethis do
  describe "making a class configurable from a yml file" do
    context "when the base path is unmodified" do
      Given { Configurethis.use_defaults }
      Given (:klass) { ConventionalPath }
      Then  { expect(klass.configuration_path).to eql('/conventional_path.yml') }
    end

    context "when the base configuration path has been modified" do
      Given { Configurethis.root_path = '/my/custom/path' }

      context "and the class specifies it's own configuration filename" do
        Given (:klass) { OverridePath }
        Then  { expect(klass.configuration_path).to eql('/my/custom/path/configure/custom.yml') }
      end

      describe "and the class relies on convention over configuration for filename" do
        context "and there is no namespace" do
          Given (:klass) { ConventionalPath.reload_configuration }
          Then  { expect(klass.configuration_path).to eql('/my/custom/path/conventional_path.yml') }
        end

        context "and the class is namespaced" do
          Given (:klass) { MyModule::ConventionalPath }
          Then  { expect(klass.configuration_path).to eql('/my/custom/path/my_module/conventional_path.yml') }
        end
      end
    end
  end

  describe "specifying a root config value for all access" do<commit_msg>Ensure clean setup for test<commit_after>require 'spec_helper'

describe Configurethis do
  describe "making a class configurable from a yml file" do
    context "when the base path is unmodified" do
      Given { Configurethis.use_defaults }
      Given (:klass) { ConventionalPath.reload_configuration }
      Then  { expect(klass.configuration_path).to eql('/conventional_path.yml') }
    end

    context "when the base configuration path has been modified" do
      Given { Configurethis.root_path = '/my/custom/path' }

      context "and the class specifies it's own configuration filename" do
        Given (:klass) { OverridePath }
        Then  { expect(klass.configuration_path).to eql('/my/custom/path/configure/custom.yml') }
      end

      describe "and the class relies on convention over configuration for filename" do
        context "and there is no namespace" do
          Given (:klass) { ConventionalPath.reload_configuration }
          Then  { expect(klass.configuration_path).to eql('/my/custom/path/conventional_path.yml') }
        end

        context "and the class is namespaced" do
          Given (:klass) { MyModule::ConventionalPath }
          Then  { expect(klass.configuration_path).to eql('/my/custom/path/my_module/conventional_path.yml') }
        end
      end
    end
  end

  describe "specifying a root config value for all access" do
{'fraction_non_alphanumeric': 0.08556738890929122, 'fraction_numerical': 0.0, 'mean_word_length': 3.017699115044248, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6527537', 'n_tokens_mistral': 774, 'n_tokens_neox': 738, 'n_words': 233}