<commit_before>require 'spec_helper'

describe VCR::Config do
  def stub_no_http_stubbing_adapter
    VCR.stub(:http_stubbing_adapter).and_raise(ArgumentError)
    VCR::Config.stub(:http_stubbing_libraries).and_return([])
  end

  describe '.cassette_library_dir=' do
    it 'creates the directory if it does not exist' do
      Dir.mktmpdir do |dir|
        dir += '/cassettes'
        expect { VCR::Config.cassette_library_dir = dir }.to change { File.exist?(dir) }.from(false).to(true)
      end
    end

    it 'does not raise an error if given nil' do
      expect { VCR::Config.cassette_library_dir = nil }.to_not raise_error
    end
  end

  describe '.default_cassette_options' do
    it 'has a hash with some defaults even if it is set to nil' do
      VCR::Config.default_cassette_options = nil
      VCR::Config.default_cassette_options.should == {
        :match_requests_on => VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES,
        :record            => :once
      }
    end

    it "returns #{VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES.inspect} for :match_requests_on when other defaults have been set" do
      VCR::Config.default_cassette_options = { :record => :none }
      VCR::Config.default_cassette_options.should include(:match_requests_on => VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES)
    end

    it "returns :once for :record when other defaults have been set" do
      VCR::Config.default_cassette_options = { :erb => :true }
      VCR::Config.default_cassette_options.should include(:record => :once)
    end
  end<commit_msg>Fix spec so it passes on JRuby on travis.<commit_after>require 'spec_helper'

describe VCR::Config do
  def stub_no_http_stubbing_adapter
    VCR.stub(:http_stubbing_adapter).and_raise(ArgumentError)
    VCR::Config.stub(:http_stubbing_libraries).and_return([])
  end

  describe '.cassette_library_dir=' do
    let(:tmp_dir) { VCR::SPEC_ROOT + '../tmp/cassette_library_dir/new_dir' }
    after(:each) { FileUtils.rm_rf tmp_dir }

    it 'creates the directory if it does not exist' do
      expect { VCR::Config.cassette_library_dir = tmp_dir }.to change { File.exist?(tmp_dir) }.from(false).to(true)
    end

    it 'does not raise an error if given nil' do
      expect { VCR::Config.cassette_library_dir = nil }.to_not raise_error
    end
  end

  describe '.default_cassette_options' do
    it 'has a hash with some defaults even if it is set to nil' do
      VCR::Config.default_cassette_options = nil
      VCR::Config.default_cassette_options.should == {
        :match_requests_on => VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES,
        :record            => :once
      }
    end

    it "returns #{VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES.inspect} for :match_requests_on when other defaults have been set" do
      VCR::Config.default_cassette_options = { :record => :none }
      VCR::Config.default_cassette_options.should include(:match_requests_on => VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES)
    end

    it "returns :once for :record when other defaults have been set" do
      VCR::Config.default_cassette_options = { :erb => :true }
      VCR::Config.default_cassette_options.should include(:record => :once)
    end
  end
{'fraction_non_alphanumeric': 0.10015552099533437, 'fraction_numerical': 0.0, 'mean_word_length': 3.778603268945022, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '3792848', 'n_tokens_mistral': 1052, 'n_tokens_neox': 1041, 'n_words': 245}