Sha256: ed86ad9bc4a47da7a3485b3518d071fde7212f1b4e6b4c85b326d7631dab592c

Contents?: true

Size: 733 Bytes

Versions: 2

Compression:

Stored size: 733 Bytes

Contents

require 'spec_helper'

describe ApplixHash do
  it 'parses dashed string options' do
    (ApplixHash.parse '--foo-bar').should == ["foo-bar".to_sym, true]
    (ApplixHash.parse '--foo-bar=321').should == ["foo-bar".to_sym, '321']
  end

  it "parses the old unit test..." do
    #   -f                becomes { :f      => true }
    #   --flag            becomes { :flag   => true }
    (ApplixHash.parse '-f').should == [:f, true]
    (ApplixHash.parse '--flag').should == [:flag, true]
    #   --flag:false      becomes { :flag   => false }
    (ApplixHash.parse '--flag:false').should == [:flag, false]

    #   --option=value    becomes { :option => "value" }
    (ApplixHash.parse '--opt=val').should == [:opt, 'val']
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
applix-0.4.11 spec/applix_hash_spec.rb
applix-0.4.10 spec/applix_hash_spec.rb