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.9.14-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.14 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.13-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.13 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.12-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.12 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.12.beta.0-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.12.beta.0 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.11 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.11-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.10 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.10-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.9-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.9 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.8-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.8 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.7-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.7 spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.6-java spec/lib/appsignal/hooks/unicorn_spec.rb
appsignal-2.9.6 spec/lib/appsignal/hooks/unicorn_spec.rb