Sha256: b3e39ab04e1b1c7c06a25f68140a9a9150d8c7e0a868b0107ae048e30c3ac2ab

Contents?: true

Size: 627 Bytes

Versions: 8

Compression:

Stored size: 627 Bytes

Contents

require "test_helper"

describe Slop do
  describe ".parse" do
    it "parses a list of arguments" do
      result = Slop.parse(%w[--name Lee]) do |o|
        o.string "--name"
      end

      assert_equal "Lee", result[:name]
    end
  end

  describe ".option_defined?" do
    it "handles bad constant names" do
      assert_equal false, Slop.option_defined?("Foo?Bar")
    end

    it "returns false if the option is not defined" do
      assert_equal false, Slop.option_defined?("FooBar")
    end

    it "returns true if the option is defined" do
      assert_equal true, Slop.option_defined?("String")
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
slop-4.10.1 test/slop_test.rb
slop-4.10.0 test/slop_test.rb
slop-4.9.3 test/slop_test.rb
slop-4.9.2 test/slop_test.rb
slop-4.9.1 test/slop_test.rb
slop-4.9.0 test/slop_test.rb
slop-4.8.2 test/slop_test.rb
slop-4.8.1 test/slop_test.rb