Sha256: ac3f14c704bef8678c0fb867681c3c610b7edc87174e0b905d1b1832c2fda5d6

Contents?: true

Size: 907 Bytes

Versions: 3

Compression:

Stored size: 907 Bytes

Contents

require 'spec_helper'
module Alf
  describe Shell, ".from_argv(argv, Heading)" do

    subject{ Shell.from_argv(argv, Heading) }

    context "on an empty array" do
      let(:argv){ [] }
      it{ should eq(Heading.new({})) }
    end

    context "on a single pair" do
      let(:argv){ ["name", "String"] }
      it{ should eq(Heading.new :name => String) }
    end

    context "on a double pair" do
      let(:argv){ ["name", "String", "age", "Fixnum"] }
      it{ should eq(Heading.new :name => String, :age => Fixnum) }
    end

    context "on odd number of strings" do
      let(:argv){ ["hello", "world", "foo"] }
      specify{
        lambda{ subject }.should raise_error(Myrrha::Error)
      }
    end

    context "when passed an unrecognized argument" do
      let(:argv){ :not_recognized }
      specify{
        lambda{ subject }.should raise_error(Myrrha::Error)
      }
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
alf-shell-0.14.0 spec/unit/from_argv/test_to_heading.rb
alf-shell-0.13.1 spec/unit/from_argv/test_to_heading.rb
alf-shell-0.13.0 spec/unit/from_argv/test_to_heading.rb