Sha256: 5be4fc03c8b0a93e18bb2241c06f7785884532b6c6683cb4adf7ed9c61107947

Contents?: true

Size: 724 Bytes

Versions: 4

Compression:

Stored size: 724 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

4 entries across 4 versions & 2 rubygems

Version Path
scheduler_daemon-1.1.3 spec/command_line_args_to_hash_spec.rb
scheduler_daemon_robertcigan-1.1.3 spec/command_line_args_to_hash_spec.rb
scheduler_daemon-1.1.2 spec/command_line_args_to_hash_spec.rb
scheduler_daemon-1.1.1 spec/command_line_args_to_hash_spec.rb