<commit_before>require File.expand_path('../spec_helper', __FILE__)

require 'bcsec'

describe Bcsec do
  before do
    Bcsec.authority = nil
    Bcsec.configuration = nil
  end

  describe "::VERSION" do
    it "exists" do
      lambda { Bcsec::VERSION }.should_not raise_error
    end

    it "has three or four dot-separated parts" do
      Bcsec::VERSION.split('.').size.should be_between(3, 4)
    end
  end

  describe "configuration" do
    it "can be set directly" do
      Bcsec.configuration = Bcsec::Configuration.new { portal :ENU }
      Bcsec.configuration.portal.should == :ENU
    end

    it "does not accumulate direct set configurations" do
      Bcsec.configuration = Bcsec::Configuration.new { api_mode :basic }
      Bcsec.configuration = Bcsec::Configuration.new { portal :ENU }
      Bcsec.configuration.api_modes.should == [] # the default
    end

    it "can be configured using #configure" do
      Bcsec.configure { portal :ENU }
      Bcsec.configuration.portal.should == :ENU<commit_msg>Clean up changes made to Bcsec.authority and Bcsec.configuration.<commit_after>require File.expand_path('../spec_helper', __FILE__)

require 'bcsec'

describe Bcsec do
  before do
    Bcsec.authority = nil
    Bcsec.configuration = nil
  end

  after do
    Bcsec.authority = nil
    Bcsec.configuration = nil
  end

  describe "::VERSION" do
    it "exists" do
      lambda { Bcsec::VERSION }.should_not raise_error
    end

    it "has three or four dot-separated parts" do
      Bcsec::VERSION.split('.').size.should be_between(3, 4)
    end
  end

  describe "configuration" do
    it "can be set directly" do
      Bcsec.configuration = Bcsec::Configuration.new { portal :ENU }
      Bcsec.configuration.portal.should == :ENU
    end

    it "does not accumulate direct set configurations" do
      Bcsec.configuration = Bcsec::Configuration.new { api_mode :basic }
      Bcsec.configuration = Bcsec::Configuration.new { portal :ENU }
      Bcsec.configuration.api_modes.should == [] # the default
    end

    it "can be configured using #configure" do
      Bcsec.configure { portal :ENU }
      Bcsec.configuration.portal.should == :ENU
{'fraction_non_alphanumeric': 0.09759481961147086, 'fraction_numerical': 0.0018501387604070306, 'mean_word_length': 3.073446327683616, 'pattern_counts': {'":': 2, '<': 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': '3555521', 'n_tokens_mistral': 690, 'n_tokens_neox': 672, 'n_words': 187}