Sha256: 0c1e88298603f40ea445faf17121296b75073ae70537e8fd3e88915eb1e6d22d

Contents?: true

Size: 1.04 KB

Versions: 36

Compression:

Stored size: 1.04 KB

Contents

require 'spec_helper'

describe "Unicorn integration" do
  let(:file) { File.expand_path('lib/appsignal/integrations/unicorn.rb') }
  before(:all) do
    module Unicorn
      class HttpServer
        def worker_loop(worker)
        end
      end

      class Worker
        def close
        end
      end
    end
  end
  before do
    load file
    start_agent
  end

  it "adds behavior to Unicorn::HttpServer#worker_loop" do
    server = Unicorn::HttpServer.new
    worker = double

    Appsignal.agent.should_receive(:forked!)
    server.should_receive(:original_worker_loop).with(worker)

    server.worker_loop(worker)
  end

  it "should add behavior to Unicorn::Worker#close" do
    worker = Unicorn::Worker.new

    Appsignal.agent.should_receive(:shutdown).with(true)
    worker.should_receive(:original_close)

    worker.close
  end

  context "without unicorn" do
    before(:all) { Object.send(:remove_const, :Unicorn) }

    specify { expect { Unicorn }.to raise_error(NameError) }
    specify { expect { load file }.to_not raise_error }
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
appsignal-0.9.1 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.9.0 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.15 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.9.0.beta.1 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.9.0.alpha.1 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.14 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.13 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.12 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.11 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.10 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.8 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.7 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.7.alpha.1 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.6 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.6.beta.1 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.6.beta.0 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.5 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.4 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.4.beta.1 spec/lib/appsignal/integrations/unicorn_spec.rb
appsignal-0.8.4.beta.0 spec/lib/appsignal/integrations/unicorn_spec.rb