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.1.5 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.5.beta.4 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.5.beta.3 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.5.beta.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.5.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.4 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.4.beta.3 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.4.beta.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.4.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.3 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.3.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.1.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.0.beta.13 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.0.beta.12 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.0.7 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.0.6 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.1.0.beta.11 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-1.0.6.beta.4 spec/lib/appsignal/hooks/unicorn_spec.rb