Sha256: 019d4f7716a9d9813ae658c0c27fc79060a13189d7e4c3661caec5fe1f2d3e22

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

require 'spec_helper'

if rails_present?
  describe Appsignal::Integrations::Railtie do
    context "after initializing the app" do
      before :all do
        MyApp::Application.config.root = project_fixture_path
        MyApp::Application.initialize!
      end

      context "logger" do
        subject { Appsignal.logger }

        it { should be_a Logger }
      end

      context "config" do
        subject { Appsignal.config }

        it { should be_a(Appsignal::Config) }

        its(:root_path) { should == Pathname.new(project_fixture_path) }
        its(:env)       { should == 'test' }
        its([:name])    { should == 'TestApp' }

        context "initial config" do
          subject { Appsignal.config.initial_config }

          its([:name]) { should == 'MyApp' }
        end
      end

      context "agent" do
        subject { Appsignal.agent }

        it { should be_a(Appsignal::Agent) }
      end

      it "should have added the listener middleware" do
        MyApp::Application.middleware.to_a.should include Appsignal::Rack::Listener
      end

      it "should have added the js exception catcher middleware" do
        MyApp::Application.middleware.to_a.should include Appsignal::Rack::JSExceptionCatcher
      end

      it "should not have added the instrumentation middleware" do
        MyApp::Application.middleware.to_a.should_not include Appsignal::Rack::Instrumentation
      end
    end

    context "with APPSIGNAL_APP_ENV ENV var set" do
      around do |sample|
        ENV['APPSIGNAL_APP_ENV'] = 'env_test'

        MyEnvApp::Application.config.root = project_fixture_path
        MyEnvApp::Application.initialize!

        sample.run

        ENV.delete('APPSIGNAL_APP_ENV')
      end
      subject { Appsignal.config }

      its(:env) { should == 'env_test' }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
appsignal-0.11.8.beta.2 spec/lib/appsignal/integrations/rails_spec.rb
appsignal-0.11.8.beta.1 spec/lib/appsignal/integrations/rails_spec.rb