Sha256: 0bcb31dbb359dd1dcf47583587f407b9e2b972f8c071c621933b2c71232720e3

Contents?: true

Size: 961 Bytes

Versions: 5

Compression:

Stored size: 961 Bytes

Contents

require 'spec_helper'
module Alf
  describe Boolean do

    describe "from_argv" do

      subject{ Boolean.from_argv(argv, opts) }

      describe "with a String" do
        let(:argv){ %w{true} }
        let(:opts) {{}}
        it{ should eq(true) }
      end

      describe "with nothing but a default" do
        let(:argv){ %w{} }
        let(:opts){ {:default => true} }
        it{ should eq(true) }
      end

      describe "with nothing and no default" do
        let(:argv){ %w{} }
        let(:opts){ {} }
        it{ should eq(false) }
      end

      describe "with an invalid string" do
        let(:argv){ %w{hello} }
        let(:opts){ {} }
        specify{ lambda{subject}.should raise_error(ArgumentError) }
      end

      describe "with more than one string" do
        let(:argv){ %w{hello world} }
        let(:opts){ {} }
        specify{ lambda{subject}.should raise_error(ArgumentError) }
      end

    end # from_argv

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-0.12.2 spec/unit/alf-core/types/test_boolean.rb
alf-0.12.1 spec/unit/alf-core/types/test_boolean.rb
alf-0.12.0 spec/unit/alf-core/types/test_boolean.rb
alf-0.11.1 spec/unit/alf-core/types/test_boolean.rb
alf-0.11.0 spec/unit/alf-core/types/test_boolean.rb