<commit_before>$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "vault"

require "pathname"
require "webmock/rspec"

require_relative "support/vault_server"
require_relative "support/redirect_server"
require_relative "support/sample_certificate"

def vault_version_string
  @vault_version_string ||= `vault --version`
end

TEST_VAULT_VERSION = Gem::Version.new(vault_version_string.match(/(\d+\.\d+\.\d+)/)[1])

RSpec.configure do |config|
  # Custom helper modules and extensions

  # Prohibit using the should syntax
  config.expect_with :rspec do |spec|
    spec.syntax = :expect
  end

  # Allow tests to isolate a specific test using +focus: true+. If nothing
  # is focused, then all tests are executed.
  config.filter_run_when_matching :focus
  config.filter_run_excluding vault: lambda { |v|
    !vault_meets_requirements?(v)
  }
  config.filter_run_excluding ent_vault: lambda { |v|
    !vault_is_enterprise? && !vault_meets_requirements?(v)
  }
  config.filter_run_excluding non_ent_vault: lambda { |v|
    vault_is_enterprise? || !vault_meets_requirements?(v)
  }

  # Disable real connections.
  config.before(:suite) do
    WebMock.disable_net_connect!(allow_localhost: true)
  end

  # Ensure our configuration is reset on each run.
  config.before(:each) { Vault.setup! }
  config.after(:each)  { Vault.setup! }

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = 'random'
end

def tmp
  Pathname.new(File.expand_path("../tmp", __FILE__))<commit_msg>Fix enterprise version detection.<commit_after>$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "vault"

require "pathname"
require "webmock/rspec"

require_relative "support/vault_server"
require_relative "support/redirect_server"
require_relative "support/sample_certificate"

def vault_version_string
  @vault_version_string ||= `vault --version`
end

TEST_VAULT_VERSION = Gem::Version.new(vault_version_string.match(/(\d+\.\d+\.\d+)/)[1])

RSpec.configure do |config|
  # Custom helper modules and extensions

  # Prohibit using the should syntax
  config.expect_with :rspec do |spec|
    spec.syntax = :expect
  end

  # Allow tests to isolate a specific test using +focus: true+. If nothing
  # is focused, then all tests are executed.
  config.filter_run_when_matching :focus
  config.filter_run_excluding vault: lambda { |v|
    !vault_meets_requirements?(v)
  }
  config.filter_run_excluding ent_vault: lambda { |v|
    !vault_is_enterprise? || !vault_meets_requirements?(v)
  }
  config.filter_run_excluding non_ent_vault: lambda { |v|
    vault_is_enterprise? || !vault_meets_requirements?(v)
  }

  # Disable real connections.
  config.before(:suite) do
    WebMock.disable_net_connect!(allow_localhost: true)
  end

  # Ensure our configuration is reset on each run.
  config.before(:each) { Vault.setup! }
  config.after(:each)  { Vault.setup! }

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = 'random'
end

def tmp
  Pathname.new(File.expand_path("../tmp", __FILE__))
{'fraction_non_alphanumeric': 0.10737656157049376, 'fraction_numerical': 0.00297441998810232, 'mean_word_length': 4.3808, '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': '5282872', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1099, 'n_words': 292}