Sha256: 12e6d9a3a7886b8ad589fe8577c63768bd3d9446e69c4bbeef74479bcff35d3f

Contents?: true

Size: 952 Bytes

Versions: 8

Compression:

Stored size: 952 Bytes

Contents

require 'spec_helper'

describe "Unicorn integration" do
  before do
    Honeybadger::Dependency.reset!
  end

  context "when unicorn is not installed" do
    it "fails quietly" do
      expect { Honeybadger::Dependency.inject! }.not_to raise_error
    end
  end

  context "when unicorn is installed" do
    let(:shim) {
      Class.new {
        def init_worker_process(worker)
          'foo'
        end
      }
    }

    before do
      Object.const_set(:Unicorn, Module.new)
      Unicorn.const_set(:HttpServer, shim)
    end
    after { Object.send(:remove_const, :Unicorn) }

    it "logs installation" do
      Honeybadger.should_receive(:write_verbose_log).with(/Unicorn/)
      Honeybadger::Dependency.inject!
    end

    it "installs unicorn hooks" do
      Honeybadger::Dependency.inject!
      Honeybadger::Monitor.worker.should_receive(:fork)
      expect(shim.new.init_worker_process(double('worker'))).to eq 'foo'
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
honeybadger-1.16.7 spec/honeybadger/integrations/unicorn_spec.rb
honeybadger-1.16.6 spec/honeybadger/integrations/unicorn_spec.rb
honeybadger-1.16.5 spec/honeybadger/integrations/unicorn_spec.rb
honeybadger-1.16.4 spec/honeybadger/integrations/unicorn_spec.rb
honeybadger-1.16.3 spec/honeybadger/integrations/unicorn_spec.rb
honeybadger-1.16.2 spec/honeybadger/integrations/unicorn_spec.rb
honeybadger-1.16.1 spec/honeybadger/integrations/unicorn_spec.rb
honeybadger-1.16.0 spec/honeybadger/integrations/unicorn_spec.rb