Sha256: e2b1969026b98d1bae58cfbca170827834815eb71bb49207b3e293edd68217d3

Contents?: true

Size: 727 Bytes

Versions: 2

Compression:

Stored size: 727 Bytes

Contents

require 'spec_helper'
require 'scheduler_daemon/command_line_args_to_hash'

describe CommandLineArgsToHash do
  it 'should process arguments' do
    h = CommandLineArgsToHash.parse(['--hello'])
    h['hello'].should == true
  end
  
  it 'should change key names with - to _' do
    h = CommandLineArgsToHash.parse(['--hi-there'])
    h['hi_there'].should == true
  end
  
  it 'should play nice with array args' do
    h = CommandLineArgsToHash.parse(['--only=one,two,three'], :array_args => 'only')
    h['only'].should == %w(one two three)
  end
  
  it 'should handle multiple args ok' do
    h = CommandLineArgsToHash.parse(['--one', '--two=three'])
    h['one'].should == true
    h['two'].should == 'three'
  end
  
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
scheduler_daemon-1.1.5 spec/command_line_args_to_hash_spec.rb
scheduler_daemon_3lancers-1.1.5 spec/command_line_args_to_hash_spec.rb