<commit_before>require 'spec_helper'

describe RspecApiDocumentation::Configuration do
  let(:parent) { nil }
  let(:configuration) { RspecApiDocumentation::Configuration.new(parent) }

  subject { configuration }

  its(:parent) { should equal(parent) }
  its(:settings) { should == {} }
  its(:groups) { should == [] }

  describe ".add_setting" do
    it 'should allow creating a new setting' do
      RspecApiDocumentation::Configuration.add_setting :new_setting
      configuration.should respond_to(:new_setting)
      configuration.should respond_to(:new_setting=)
    end

    it 'should allow setting a default' do
      RspecApiDocumentation::Configuration.add_setting :new_setting, :default => "default"
      configuration.new_setting.should == "default"
    end

    it "should allow the default setting to be a lambda" do
      RspecApiDocumentation::Configuration.add_setting :another_setting, :default => lambda { |config| config.new_setting }
      configuration.another_setting.should == "default"
    end
  end

  describe "default settings" do
    let(:default_template_path) { File.expand_path("../../templates", __FILE__) }

    its(:docs_dir) { should == Rails.root.join("docs") }
    its(:format) { should == :html }
    its(:template_path) { should == default_template_path }
    its(:filter) { should == :all }
    its(:exclusion_filter) { should == nil }
    its(:app) { should == Rails.application }

    context "no rails" do
      before do
        Object.class_eval do
          remove_const(:Rails)
        end<commit_msg>Use Object.send instead of Object.class_eval<commit_after>require 'spec_helper'

describe RspecApiDocumentation::Configuration do
  let(:parent) { nil }
  let(:configuration) { RspecApiDocumentation::Configuration.new(parent) }

  subject { configuration }

  its(:parent) { should equal(parent) }
  its(:settings) { should == {} }
  its(:groups) { should == [] }

  describe ".add_setting" do
    it 'should allow creating a new setting' do
      RspecApiDocumentation::Configuration.add_setting :new_setting
      configuration.should respond_to(:new_setting)
      configuration.should respond_to(:new_setting=)
    end

    it 'should allow setting a default' do
      RspecApiDocumentation::Configuration.add_setting :new_setting, :default => "default"
      configuration.new_setting.should == "default"
    end

    it "should allow the default setting to be a lambda" do
      RspecApiDocumentation::Configuration.add_setting :another_setting, :default => lambda { |config| config.new_setting }
      configuration.another_setting.should == "default"
    end
  end

  describe "default settings" do
    let(:default_template_path) { File.expand_path("../../templates", __FILE__) }

    its(:docs_dir) { should == Rails.root.join("docs") }
    its(:format) { should == :html }
    its(:template_path) { should == default_template_path }
    its(:filter) { should == :all }
    its(:exclusion_filter) { should == nil }
    its(:app) { should == Rails.application }

    context "no rails" do
      before do
        Object.send(:remove_const, :Rails)
{'fraction_non_alphanumeric': 0.11832797427652733, 'fraction_numerical': 0.0, 'mean_word_length': 3.8533541341653668, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7527377', 'n_tokens_mistral': 897, 'n_tokens_neox': 868, 'n_words': 213}