Sha256: c10d167967484bab9091b6ddd22e9096f569d591e7f6df612b60a92a97f06ef6

Contents?: true

Size: 1.16 KB

Versions: 13

Compression:

Stored size: 1.16 KB

Contents

if DependencyHelper.sinatra_present?
  ENV['APPSIGNAL_PUSH_API_KEY'] = 'key'
  require 'appsignal/integrations/sinatra'

  describe "Sinatra integration" do
    context "Appsignal.logger" do
      subject { Appsignal.logger }

      it { should be_a Logger }
    end

    describe "middleware" do
      it "adds the instrumentation middleware to Sinatra::Base" do
        Sinatra::Base.middleware.to_a.should include(
          [Appsignal::Rack::SinatraBaseInstrumentation, [], nil]
        )
      end
    end

    describe "environment" do
      subject { Appsignal.config.env }

      context "without APPSIGNAL_APP_ENV" do
        before do
          load File.expand_path('lib/appsignal/integrations/sinatra.rb', project_dir)
        end

        it "uses the app environment" do
          expect(subject).to eq('test')
        end
      end

      context "with APPSIGNAL_APP_ENV" do
        before do
          ENV['APPSIGNAL_APP_ENV'] = 'env-staging'
          load File.expand_path('lib/appsignal/integrations/sinatra.rb', project_dir)
        end

        it "uses the environment variable" do
          expect(subject).to eq('env-staging')
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
appsignal-2.0.6 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.0.5 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.0.5.beta.1 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.1.0.alpha.3 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.1.0.alpha.2 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.1.0.alpha.1 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.0.4 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.0.3 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.0.2 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.0.1 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.0.0 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-2.0.0.beta.1 spec/lib/appsignal/integrations/sinatra_spec.rb
appsignal-1.4.0.beta.1 spec/lib/appsignal/integrations/sinatra_spec.rb