<commit_before># frozen_string_literal: true

# Report test coverage to coveralls for only one Ruby version to avoid
# repeated builds. This also accounts for coveralls_reborn requiring
# RUBY_VERSION >= 2.5.
if RUBY_VERSION.start_with?("3.1.")
  require "coveralls"
  Coveralls.wear!
end

require "stripe"
require "test/unit"
require "mocha/setup"
require "stringio"
require "shoulda/context"
require "webmock/test_unit"

PROJECT_ROOT = ::File.expand_path("../", __dir__)

require ::File.expand_path("test_data", __dir__)
require ::File.expand_path("stripe_mock", __dir__)

MOCK_MINIMUM_VERSION = "0.109.0"
MOCK_PORT = Stripe::StripeMock.start

# Disable all real network connections except those that are outgoing to
# stripe-mock.
WebMock.disable_net_connect!(allow: "localhost:#{MOCK_PORT}")

# Try one initial test connection to stripe-mock so that if there's a problem
# we can print one error and fail fast so that it's more clear to the user how<commit_msg>Do not run Coveralls if secret token is not available (#1137)<commit_after># frozen_string_literal: true

# Report test coverage to coveralls for only one Ruby version to avoid
# repeated builds. This also accounts for coveralls_reborn requiring
# RUBY_VERSION >= 2.5.
if ENV.key?("COVERALLS_REPO_TOKEN") && RUBY_VERSION.start_with?("3.1.")
  require "coveralls"
  Coveralls.wear!
end

require "stripe"
require "test/unit"
require "mocha/setup"
require "stringio"
require "shoulda/context"
require "webmock/test_unit"

PROJECT_ROOT = ::File.expand_path("../", __dir__)

require ::File.expand_path("test_data", __dir__)
require ::File.expand_path("stripe_mock", __dir__)

MOCK_MINIMUM_VERSION = "0.109.0"
MOCK_PORT = Stripe::StripeMock.start

# Disable all real network connections except those that are outgoing to
# stripe-mock.
WebMock.disable_net_connect!(allow: "localhost:#{MOCK_PORT}")

# Try one initial test connection to stripe-mock so that if there's a problem
# we can print one error and fail fast so that it's more clear to the user how
{'fraction_non_alphanumeric': 0.10278053624627606, 'fraction_numerical': 0.010923535253227408, 'mean_word_length': 5.628289473684211, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1415569', 'n_tokens_mistral': 665, 'n_tokens_neox': 641, 'n_words': 210}