Sha256: 13478ec7fd19671840843280eaf4ccbd433ac6ce2013455447d813271066f2fb

Contents?: true

Size: 1.02 KB

Versions: 97

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

describe Appsignal::Hooks::UnicornHook do
  context "with unicorn" do
    before :all do
      module Unicorn
        class HttpServer
          def worker_loop(worker)
          end
        end

        class Worker
          def close
          end
        end
      end
      Appsignal::Hooks::UnicornHook.new.install
    end
    after(:all) { Object.send(:remove_const, :Unicorn) }

    its(:dependencies_present?) { should be_true }

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

      Appsignal.should_receive(:forked)
      server.should_receive(:worker_loop_without_appsignal).with(worker)

      server.worker_loop(worker)
    end

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

      Appsignal.should_receive(:stop)
      worker.should_receive(:close_without_appsignal)

      worker.close
    end
  end

  context "without unicorn" do
    its(:dependencies_present?) { should be_false }
  end
end

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
appsignal-1.2.1.beta.3 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.1.beta.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.1.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.0 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.0.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.0.alpha.6 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.0.alpha.5 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.0.alpha.4 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.9 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.9.beta.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.9.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.8 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.0.alpha.3 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.7 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.0.alpha.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.7.beta.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.2.0.alpha.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.7.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.6 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.6.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb