Sha256: 06f36ecc459fc0a1c52ed5c10f9b071b9cc2466579656bd0de94103759ed947a

Contents?: true

Size: 1.21 KB

Versions: 202

Compression:

Stored size: 1.21 KB

Contents

describe Appsignal::Hooks::UnicornHook do
  context "with unicorn" do
    before :context 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(:context) { Object.send(:remove_const, :Unicorn) }

    describe "#dependencies_present?" do
      subject { described_class.new.dependencies_present? }

      it { is_expected.to be_truthy }
    end

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

      expect(Appsignal).to receive(:forked)
      expect(server).to receive(:worker_loop_without_appsignal).with(worker)

      server.worker_loop(worker)
    end

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

      expect(Appsignal).to receive(:stop)
      expect(worker).to receive(:close_without_appsignal)

      worker.close
    end
  end

  context "without unicorn" do
    describe "#dependencies_present?" do
      subject { described_class.new.dependencies_present? }

      it { is_expected.to be_falsy }
    end
  end
end

Version data entries

202 entries across 202 versions & 1 rubygems

Version Path
appsignal-2.11.10-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.10 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.9-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.9 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.8-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.8 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.7 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.7-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.6 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.6-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.5-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.5 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.4-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.4 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.3-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.3 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.2-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.1-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.11.1 spec/lib/appsignal/hooks/unicorn_spec.rb