Sha256: 51b4b6a74e58ce7cfcca85e568d25748183afbe682204fad09929674a2c7be25

Contents?: true

Size: 1.96 KB

Versions: 1

Compression:

Stored size: 1.96 KB

Contents

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

describe JettyRails::Runner, "with no extra configuration" do
  it "should require basedir to be run" do
    lambda { JettyRails::Runner.new }.should raise_error 
  end
  
  it "should receive basedir configuration" do
    runner = JettyRails::Runner.new :base => '/any/app/dir'
    runner.config.should have_key(:base)
    runner.config[:base].should eql('/any/app/dir')
  end
  
  it "should default to development environment" do
    runner = JettyRails::Runner.new :base => Dir.pwd
    runner.config.should have_key(:environment)
    runner.config[:environment].should eql('development')
    runner.app_context.init_params['rails.env'].should eql('development')
  end
  
  it "should default to the root context path" do
    runner = JettyRails::Runner.new :base => Dir.pwd
    runner.config.should have_key(:context_path)
    runner.config[:context_path].should eql('/')
    runner.app_context.context_path.should eql('/')
  end
  
  it "should set rails root" do
    runner = JettyRails::Runner.new :base => Dir.pwd
    runner.app_context.init_params['rails.root'].should eql('/')
  end
  
  it "should set public root" do
    runner = JettyRails::Runner.new :base => Dir.pwd
    runner.app_context.init_params['public.root'].should eql('/public')
  end
end

describe JettyRails::Runner, "with custom configuration" do
  
  it "should allow to override the environment" do
    runner = JettyRails::Runner.new :base => Dir.pwd, :environment => 'production'
    runner.config.should have_key(:environment)
    runner.config[:environment].should eql('production')
    runner.app_context.init_params['rails.env'].should eql('production')
  end
  
  it "should allow to override the context path" do
    runner = JettyRails::Runner.new :base => Dir.pwd, :context_path => "/myapp" 
    runner.config.should have_key(:context_path)
    runner.config[:context_path].should eql('/myapp')
    runner.app_context.context_path.should eql('/myapp')
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jetty-rails-0.1 spec/jetty_rails/runner_spec.rb