Sha256: 5bc1140e8c637875785ff241ac2133b3e4b1fbe9b9e564d78d16cd785931fa80

Contents?: true

Size: 623 Bytes

Versions: 3

Compression:

Stored size: 623 Bytes

Contents

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

$pop = PlainOptionParser.new do
  desc "set abc"
  cmd "test set abc" do |value|
    $abc = value
    $abc += flags["app"] if flags["app"]
  end
  
  desc "unset abc"
  cmd "test unset abc" do
    $abc = false
  end
end

describe "PlainOptionParser" do
  it "should set abc" do
    $pop.start %w[test set abc 123]
    $abc.should == "123"
  end
  
  it "should unset abc" do
    $pop.start %w[test unset abc]
    $abc.should be_false
  end
  
  it "should take a flag" do
    $pop.start %w[test set abc 123 --app foo]
    $abc.should == "123foo"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plain_option_parser-0.1.2 spec/plain_option_parser_spec.rb
plain_option_parser-0.1.1 spec/plain_option_parser_spec.rb
plain_option_parser-0.1.0 spec/plain_option_parser_spec.rb