Sha256: 29281d6c7768282bb1114a7794dc8dcce4a1fd5cdc31ff98eab937e630528cc6

Contents?: true

Size: 613 Bytes

Versions: 3

Compression:

Stored size: 613 Bytes

Contents

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

    subject{ Shell.from_argv(argv, Predicate) }

    describe "from a singleton Array" do
      let(:argv){ ["status == 10"] }

      specify{
        subject.expr.should be_a(Predicate::Native)
        subject.to_ruby_literal.should eq("lambda{ status == 10 }")
      }
    end

    describe "from an Array with coercion" do
      let(:argv){ ["status", "10"] }

      specify{
        subject.expr.should be_a(Predicate::Eq)
        subject.expr.should eq([:eq, [:var_ref, :status], [:literal, 10]])
      }
    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_predicate.rb
alf-shell-0.13.1 spec/unit/from_argv/test_to_predicate.rb
alf-shell-0.13.0 spec/unit/from_argv/test_to_predicate.rb