Sha256: 9cf672f9dd55648a1c26c6a65f3a5ae836281801d7599377dafa3014e916fcad

Contents?: true

Size: 852 Bytes

Versions: 22

Compression:

Stored size: 852 Bytes

Contents

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

class BooleanParamTest < Test::Unit::TestCase
  include SproutTestCase

  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

22 entries across 22 versions & 1 rubygems

Version Path
sprout-1.0.1.pre test/unit/boolean_param_test.rb
sprout-1.0.0.pre test/unit/boolean_param_test.rb