<commit_before>require 'hawkular'
require 'metrics/metrics_client'
require 'inventory/inventory_api'
require 'tokens/tokens_api'
require 'alerts/alerts_api'
require 'rspec/core'
require 'rspec/mocks'
require 'socket'
require 'uri'
require 'yaml'
require 'coveralls'

Coveralls.wear!

module Hawkular::Metrics::RSpec
  def setup_client(options = {})
    credentials = {
      username: config['user'],
      password: config['password']
    }
    @client = Hawkular::Metrics::Client.new(config['url'],
                                            credentials, options)
  end

  def setup_client_new_tenant(_options = {})
    setup_client
    @tenant = 'vcr-test-tenant-123'
    # @client.tenants.create(@tenant)
    setup_client(tenant: @tenant)
  end

  def config
    @config ||= YAML.load(
      File.read(File.expand_path('endpoint.yml', File.dirname(__FILE__)))
    )
  end
end

RSpec.configure do |config|
  config.include Hawkular::Metrics::RSpec
<commit_msg>Move coveralls to the top to pick up all app code.<commit_after># This needs to go before all requires to be able to record full coverage
require 'coveralls'
Coveralls.wear!
# Now the application requires.
require 'hawkular'
require 'metrics/metrics_client'
require 'inventory/inventory_api'
require 'tokens/tokens_api'
require 'alerts/alerts_api'
require 'rspec/core'
require 'rspec/mocks'
require 'socket'
require 'uri'
require 'yaml'

module Hawkular::Metrics::RSpec
  def setup_client(options = {})
    credentials = {
      username: config['user'],
      password: config['password']
    }
    @client = Hawkular::Metrics::Client.new(config['url'],
                                            credentials, options)
  end

  def setup_client_new_tenant(_options = {})
    setup_client
    @tenant = 'vcr-test-tenant-123'
    # @client.tenants.create(@tenant)
    setup_client(tenant: @tenant)
  end

  def config
    @config ||= YAML.load(
      File.read(File.expand_path('endpoint.yml', File.dirname(__FILE__)))
    )
  end
end

RSpec.configure do |config|
  config.include Hawkular::Metrics::RSpec

{'fraction_non_alphanumeric': 0.11980676328502415, 'fraction_numerical': 0.002898550724637681, 'mean_word_length': 3.622767857142857, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2315236', 'n_tokens_mistral': 652, 'n_tokens_neox': 649, 'n_words': 147}