<commit_before>require 'postgres_ha_admin/failover_databases'
require 'pg'

describe PostgresHaAdmin::FailoverDatabases do
  let(:logger) { Logger.new(@logger_file) }
  let(:failover_databases) { described_class.new(@yml_file, logger) }

  before do
    @yml_file = Tempfile.new('failover_databases.yml')
    @logger_file = Tempfile.new('ha_admin.log')
  end

  after do
    @yml_file.close(true)
    @logger_file.close(true)
  end

  describe "#active_databases" do
    it "return list of active databases saved in 'config/failover_databases.yml'" do<commit_msg>pass Tempfile#path (instead if instance of Tempfile) where filename expected<commit_after>require 'postgres_ha_admin/failover_databases'
require 'pg'

describe PostgresHaAdmin::FailoverDatabases do
  let(:logger) { Logger.new(@logger_file) }
  let(:failover_databases) { described_class.new(@yml_file.path, logger) }

  before do
    @yml_file = Tempfile.new('failover_databases.yml')
    @logger_file = Tempfile.new('ha_admin.log')
  end

  after do
    @yml_file.close(true)
    @logger_file.close(true)
  end

  describe "#active_databases" do
    it "return list of active databases saved in 'config/failover_databases.yml'" do
{'fraction_non_alphanumeric': 0.10720268006700168, 'fraction_numerical': 0.0, 'mean_word_length': 5.191709844559585, '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': '532813', 'n_tokens_mistral': 415, 'n_tokens_neox': 393, 'n_words': 82}