Sha256: 945222a453c1806ed106f0319785953bb0b0c9550d0a2cb5a65a6ac2e53ebd23

Contents?: true

Size: 1001 Bytes

Versions: 3

Compression:

Stored size: 1001 Bytes

Contents

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

describe "Optioner with options" do
  it "should be able to pull out the lonely arguments without any switches" do
    Optioner.parse("hello".split(" ")).should == ["hello"]
  end
  it "should be able to pull out the lonely arguments with switches" do
    Optioner.parse("-s 30.seconds -m hello world".split(" ")).should == ["world"]
  end
  it "should be able to pull out start from the the string" do
    Optioner.parse("-c 'config/config.yml' -A 'Who' -S 'DarkwingDuck' list".split(" ")).should == ["list"]
  end
  it "should be able to pull out the lonely arguments with optional argument switches" do
    Optioner.parse("-s 30 -q -n start".split(" "), %w(-q -n)).should == ["start"]
  end
  it "should pull out the lonely arguments if none are there" do
    Optioner.parse("-s 30 -q".split(" ")).should == []
  end
  it "should pull out empty array if there are no lonely arguments" do
    Optioner.parse("-s 30".split(" ")).should == []
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
auser-poolparty-0.0.8 spec/optioner_spec.rb
dreadpiratepj-poolparty-0.0.8 spec/optioner_spec.rb
poolparty-0.0.4 spec/optioner_spec.rb