Sha256: 4ae7f830f87c204be66aa78e7dfa417faf855e2fa50b055e0535d92bb0b8a8bd

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

require 'spec_helper'

describe Honeybadger do
  def send_notice
    Honeybadger.sender.send_to_honeybadger('data')
  end

  def stub_verbose_log
    Honeybadger.stub(:write_verbose_log)
  end

  def configure
    Honeybadger.configure { |config| }
  end

  it "reports that notifier is ready when configured" do
    stub_verbose_log
    Honeybadger.should_receive(:write_verbose_log).with(/Notifier (.*) ready/, anything)
    configure
  end

  it "does not report that notifier is ready when internally configured" do
    stub_verbose_log
    Honeybadger.should_not_receive(:write_verbose_log)
    Honeybadger.configure(true) { |config| }
  end

  it "prints environment info on a failed notification without a body" do
    reset_config
    stub_verbose_log
    stub_http(:response => Faraday::Response.new(:status => 500), :body => nil)
    Honeybadger.should_receive(:write_verbose_log).with(/Environment Info:/)
    Honeybadger.should_not_receive(:write_verbose_log).with(/Response from Honeybadger:/, anything)
    send_notice
  end

  it "prints environment info and response on a success with a body" do
    reset_config
    stub_verbose_log
    stub_http
    Honeybadger.should_receive(:write_verbose_log).with(/Environment Info:/)
    Honeybadger.should_receive(:write_verbose_log).with(/Response from Honeybadger:/)
    send_notice
  end

  it "prints environment info and response on a failure with a body" do
    reset_config
    stub_verbose_log
    stub_http(:response => Faraday::Response.new(:status => 500))
    Honeybadger.should_receive(:write_verbose_log).with(/Environment Info:/)
    Honeybadger.should_receive(:write_verbose_log).with(/Response from Honeybadger:/)
    send_notice
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
honeybadger-1.9.5 spec/honeybadger/logger_spec.rb
honeybadger-1.9.4 spec/honeybadger/logger_spec.rb
honeybadger-1.9.3 spec/honeybadger/logger_spec.rb