Sha256: 5cbcbed2226181a824c20dd639cddebc9db66766e8799feee2b42e9815780e2e

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

require 'test_helper'

class BooleanParamTest < Test::Unit::TestCase
  include Sprout::TestHelper

  context "a new, simple BooleanParam" do

    setup do 
      @param = Sprout::Executable::Boolean.new
      @param.name = 'foo'
    end

    should "be hidden when false" do
      @param.value = false
      assert_equal '', @param.to_shell
    end

    should "default to false" do
      assert_equal false, @param.value
    end

    should "show on true" do
      @param.value = true
      assert_equal '--foo', @param.to_shell
    end

    context "when configuring option parser" do
      
      should "update correctly" do
        @param.show_on_false = true
        @param.default = true
        @param.hidden_value = false
        assert_equal "--foo [BOOL]", @param.option_parser_declaration
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sprout-1.1.3.pre test/unit/boolean_param_test.rb
sprout-1.1.2.pre test/unit/boolean_param_test.rb