<commit_before>require 'rrod/test_server'

module Rrod
  class TestServer
    module RSpec

      def self.enable!
        Rrod.configure do |config|
          config.pb_port = Rrod::TestServer.pb_port
        end

        ::RSpec.configure do |config|
          config.before(:each, :integration => true) do
            if Rrod::TestServer.fatal
              fail "Test server not working: #{Rrod::TestServer.fatal}" 
            end

            if example.metadata[:test_server] == false
              Rrod::TestServer.stop
            else
              Rrod::TestServer.create unless Rrod::TestServer.exist?
              Rrod::TestServer.start
            end
          end

          config.after(:each, :integration => true) do
            # what on earth is happening in here???
            if !Rrod::TestServer.fatal && 
              Rrod::TestServer.started? && 
              example.metadata[:test_server] != false
              Rrod::TestServer.drop
            end
          end

          config.after(:suite) do
            Rrod::TestServer.stop if Rrod::TestServer.started?
          end
        end

      end

    end
  end
end

<commit_msg>test server tweaks<commit_after>require 'rrod/test_server'

module Rrod
  class TestServer
    module RSpec

      def self.enable!
        Rrod.configure do |config|
          config.pb_port = Rrod::TestServer.pb_port
        end

        ::RSpec.configure do |config|
          config.before(:each, :integration => true) do
            if Rrod::TestServer.fatal
              fail "Test server not working: #{Rrod::TestServer.fatal}" 
            end

            if example.metadata[:test_server] == false
              Rrod::TestServer.stop
            else
              Rrod::TestServer.create unless Rrod::TestServer.exist?
              Rrod::TestServer.start  unless Rrod::TestServer.started?
            end
          end

          config.after(:each, :integration => true) do
            # i really don't understand this...
            if !Rrod::TestServer.fatal && 
              Rrod::TestServer.started? && 
              example.metadata[:test_server] != false
              Rrod::TestServer.drop
            end
          end

          config.after(:suite) do
            Rrod::TestServer.stop if Rrod::TestServer.started?
          end
        end

      end

    end
  end
end


{'fraction_non_alphanumeric': 0.09021601016518424, 'fraction_numerical': 0.0, 'mean_word_length': 1.6186252771618626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4713062', 'n_tokens_mistral': 658, 'n_tokens_neox': 619, 'n_words': 148}