Sha256: 54f5786f26db2215cab3d5619f66a23f1abf7fcb1d639b1a335a251302327c3e

Contents?: true

Size: 1.18 KB

Versions: 18

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

describe "Puma integration" do
  let(:file) { File.expand_path('lib/appsignal/integrations/puma.rb') }
  before(:all) do
    class Puma
      def self.cli_config
        @cli_config ||= CliConfig.new
      end
    end

    class CliConfig
      attr_accessor :options

      def initialize
        @options = {}
      end
    end
  end
  before do
    start_agent
  end

  context "with a nil before worker shutdown" do
    before do
      Puma.cli_config.options.delete(:before_worker_shutdown)
      load file
    end

    it "should add a before shutdown worker callback" do
      Puma.cli_config.options[:before_worker_shutdown].first.should be_a(Proc)
    end
  end

  context "with an existing before worker shutdown" do
    before do
      Puma.cli_config.options[:before_worker_shutdown] = []
      load file
    end

    it "should add a before shutdown worker callback" do
      Puma.cli_config.options[:before_worker_shutdown].first.should be_a(Proc)
    end
  end

  context "without Puma" do
    before(:all) { Object.send(:remove_const, :Puma) }

    specify { expect { Puma }.to raise_error(NameError) }
    specify { expect { load file }.to_not raise_error }
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
appsignal-0.12.rc.7 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.rc.6 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.rc.5 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.54 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.53 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.52 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.51 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.50 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.49 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.48 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.47 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.46 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.45 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.44 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.43 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.42 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.41 spec/lib/appsignal/integrations/puma_spec.rb
appsignal-0.12.beta.40 spec/lib/appsignal/integrations/puma_spec.rb