Sha256: f747b0ec84c993abea9d4c89e970059a1947ee3639a17a717da988d688c1d2a9

Contents?: true

Size: 1.96 KB

Versions: 5

Compression:

Stored size: 1.96 KB

Contents

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

describe Trinidad::CommandLineParser do
  it "should override classes option" do
    ARGV = "--classes my_classes".split
    
    options = Trinidad::CommandLineParser.parse
    options[:classes_dir].should == 'my_classes'
  end
  
  it "should override libs option with lib option" do
    ARGV = "--lib my_libs".split
    
    options = Trinidad::CommandLineParser.parse
    options[:libs_dir].should == 'my_libs'
  end
  
  it "should override libs option with jar option" do
    ARGV = "--jars my_jars".split
    
    options = Trinidad::CommandLineParser.parse
    options[:libs_dir].should == 'my_jars'
  end
  
  it "should override the config file when it's especified" do
    ARGV = "-f #{File.join(File.dirname(__FILE__), '..', 'web_app_mock', 'tomcat.yml')}".split
    
    options = Trinidad::CommandLineParser.parse
    options[:environment].should == 'production'
  end
  
  it "should add default ssl port to options" do
    ARGV = '--ssl'.split
    
    options = Trinidad::CommandLineParser.parse
    options[:ssl].should == {:port => 8443}
  end
  
  it "should add custom ssl port to options" do
    ARGV = '--ssl 8843'.split
    
    options = Trinidad::CommandLineParser.parse
    options[:ssl].should == {:port => 8843}
  end
  
  it "should add ajp connection with default port to options" do
    ARGV = '--ajp'.split
    
    options = Trinidad::CommandLineParser.parse
    options[:ajp].should == {:port => 8009}
  end
  
  it "should add ajp connection with coustom port to options" do
    ARGV = '--ajp 8099'.split
    
    options = Trinidad::CommandLineParser.parse
    options[:ajp].should == {:port => 8099}
  end
  
  it "should merge ajp options from the config file" do
    ARGV = "--ajp 8099 -f #{File.join(File.dirname(__FILE__), '..', 'web_app_mock', 'tomcat.yml')}".split
    
    options = Trinidad::CommandLineParser.parse
    options[:ajp][:port].should == 8099
    options[:ajp][:secure].should == true
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
calavera-trinidad-0.4.0 spec/trinidad/command_line_parser_spec.rb
calavera-trinidad-0.4.1 spec/trinidad/command_line_parser_spec.rb
trinidad-0.5.0 spec/trinidad/command_line_parser_spec.rb
trinidad-0.4.0 spec/trinidad/command_line_parser_spec.rb
trinidad-0.4.1 spec/trinidad/command_line_parser_spec.rb