summaryrefslogtreecommitdiff
path: root/spec/ruby/library/getoptlong/terminated_spec.rb
blob: 6108a7f6e908e8a62f9c1e001596274a5c8dded4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
require_relative '../../spec_helper'
require 'getoptlong'

describe "GetoptLong#terminated?" do
  it "returns true if option processing has terminated" do
    argv [ "--size", "10k" ] do
      opts = GetoptLong.new(["--size", GetoptLong::REQUIRED_ARGUMENT])
      opts.should_not.terminated?

      opts.get.should == ["--size", "10k"]
      opts.should_not.terminated?

      opts.get.should == nil
      opts.should.terminated?
    end
  end
end