<commit_before>require "spec_helper"

require "lab_rat/health_checker"


describe LabRat::HealthChecker do
  context "with valid credentials" do
    let(:credentials) do
      {
        "uri"          => "amqp://guest:guest@127.0.0.1",
        "http_api_uri" => "http://guest:guest@127.0.0.1:15672/api"
      }
    end

    it "returns check results as a map" do
      m = subject.check(credentials)

      m[:uri].should == credentials["uri"]
      m[:connection].should be_connected

      m[:queue].should_not be_nil
      m[:consumed_message_payload].should_not be_nil

      m[:connection].close
    end
  end
end<commit_msg>One more test case<commit_after>require "spec_helper"

require "lab_rat/health_checker"


describe LabRat::HealthChecker do
  context "with valid credentials" do
    let(:credentials) do
      {
        "uri"          => "amqp://guest:guest@127.0.0.1",
        "http_api_uri" => "http://guest:guest@127.0.0.1:15672/api"
      }
    end

    it "returns check results as a map" do
      m = subject.check(credentials)

      m[:uri].should == credentials["uri"]
      m[:connection].should be_connected

      m[:queue].should_not be_nil
      m[:consumed_message_payload].should_not be_nil

      m[:connection].close
    end
  end


  context "with invalid credentials" do
    let(:credentials) do
      {
        "uri"          => "amqp://guest:guest@172.16.58.3",
        "http_api_uri" => "http://guest:guest@192.168.127.12:15678/api"
      }
    end

    it "returns check results with :exception" do
      m = subject.check(credentials)

      m[:exception].should_not be_nil
    end
  end
end
{'fraction_non_alphanumeric': 0.12829957028852057, 'fraction_numerical': 0.03560466543891958, 'mean_word_length': 2.638392857142857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '5280361', 'n_tokens_mistral': 590, 'n_tokens_neox': 545, 'n_words': 109}