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.10.3-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.10.3 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.10.2-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.10.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.10.1-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.10.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.10.0-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.10.0 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.18 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.18-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.18.beta.2-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.18.beta.2 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.18.beta.1 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.18.beta.1-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.17-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.17 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.16-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.16 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.15-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.15 spec/lib/appsignal/hooks/unicorn_spec.rb