Sha256: 9d244bf679bf8ff39385b64cf78eaea9621c4dcb39c7936e9ea0ae09d158e6fd

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

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

    let(:scope) {
      Support::TupleScope.new(:status => 10)
    }

    subject{ Shell.from_argv(argv, TupleExpression) }

    context "with a String (1)" do
      let(:argv){ %w{true} }
      it { should be_a(TupleExpression) }
      specify{
        subject.evaluate(scope).should eql(true)
        subject.source.should eq("true")
      }
    end

    context "with a String (2)" do
      let(:argv){ ["status > 10"] }
      it { should be_a(TupleExpression) }
      specify{
        subject.evaluate(scope).should eql(false)
        subject.source.should eq("status > 10")
      }
    end

    context "with two String" do
      let(:argv){ %w{hello world} }
      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_tuple_expression.rb
alf-shell-0.13.1 spec/unit/from_argv/test_to_tuple_expression.rb
alf-shell-0.13.0 spec/unit/from_argv/test_to_tuple_expression.rb