Sha256: ae5e0f9040447c05f4bf94fbabe8b58fd2a6fd274525738a5bfe80b86ba65b85

Contents?: true

Size: 1017 Bytes

Versions: 3

Compression:

Stored size: 1017 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe 'Trinidad lifecycle extension' do
  before(:all) do
    @options = { :path => File.expand_path('../fixtures', __FILE__) }
  end

  before(:each) do
    @context = Trinidad::Tomcat::StandardContext.new
    @tomcat = mock
    @tomcat.stubs(:server).returns(@context)
  end

  context "when it's a server extension" do
    subject { Trinidad::Extensions::LifecycleServerExtension.new(@options) }

    it "adds the listener to the tomcat's server context" do
      subject.configure(@tomcat)
      @tomcat.server.findLifecycleListeners().should have(1).listener
    end
  end

  context "when it's a webapp extension" do
    subject { Trinidad::Extensions::LifecycleWebAppExtension.new(@options) }

    it "adds the listener to the application context" do
      app_context = Trinidad::Tomcat::StandardContext.new
      subject.configure(@tomcat, app_context)
      app_context.findLifecycleListeners().should have(1).listener
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
trinidad_lifecycle_extension-0.2.2 spec/trinidad_lifecycle_extension_spec.rb
trinidad_lifecycle_extension-0.2.1 spec/trinidad_lifecycle_extension_spec.rb
trinidad_lifecycle_extension-0.1.0 spec/trinidad_lifecycle_extension_spec.rb