Sha256: 153cb5c2cc582a0336a238d6eb9e177824641d840e2ea577dfe9e52ae77e6851

Contents?: true

Size: 826 Bytes

Versions: 4

Compression:

Stored size: 826 Bytes

Contents

require '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

4 entries across 4 versions & 1 rubygems

Version Path
sprout-1.0.35.pre test/unit/boolean_param_test.rb
sprout-1.0.32.pre test/unit/boolean_param_test.rb
sprout-1.0.31.pre test/unit/boolean_param_test.rb
sprout-1.0.29.pre test/unit/boolean_param_test.rb