Sha256: 5108d61de4d7caf6db2ad00cee011542a04d0d560b40533bbf95534df808d6d5

Contents?: true

Size: 1.19 KB

Versions: 40

Compression:

Stored size: 1.19 KB

Contents

require 'pact_broker/db/log_quietener'

module PactBroker
  module DB
    describe Logger do
      let(:logs) { StringIO.new }
      let(:wrapped_logger) { ::Logger.new(logs) }

      subject { LogQuietener.new(wrapped_logger) }

      describe "error" do
        context "when the error is for a table or view that does not exist" do
          before do
            subject.error("PG::UndefinedTable - some error")
          end

          it "logs the message at debug level" do
            expect(logs.string).to include "DEBUG -- :"
          end

          it "appends a friendly message so people don't freak out" do
            expect(logs.string).to include "PG::UndefinedTable - some error Don't panic."
          end
        end

        context "when the error is NOT for a table or view that does not exist" do
          before do
            subject.error("foo bar")
          end

          it "logs the message at error level" do
            expect(logs.string).to include "ERROR -- :"
          end

          it "does not appends a friendly message so people will correctly panic" do
            expect(logs.string).to_not include "Don't panic."
          end
        end
      end
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
pact_broker-2.57.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.56.1 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.56.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.55.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.54.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.53.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.52.2 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.52.1 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.52.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.51.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.50.1 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.50.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.49.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.48.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.47.1 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.47.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.46.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.45.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.44.0 spec/lib/pact_broker/db/log_quietener_spec.rb
pact_broker-2.43.0 spec/lib/pact_broker/db/log_quietener_spec.rb