Sha256: 27df8b34439de361173ace163e65e6767b075381878311191d7eb06078f5f1c4
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
require 'spec_helper' module Alf describe TupleExpression do let(:handle) { Tools::TupleHandle.new.set(:status => 10) } describe "coerce" do subject{ TupleExpression.coerce(arg) } describe "with nil" do let(:arg){ nil } specify{ lambda{subject}.should raise_error(ArgumentError) } end describe "with a String" do let(:arg){ "true" } it { should be_a(TupleExpression) } specify{ subject.evaluate(handle).should eql(true) subject.source.should eq("true") } end describe "with a Symbol" do let(:arg){ :status } it { should be_a(TupleExpression) } specify{ subject.evaluate(handle).should eql(10) subject.source.should eq("status") } end describe "with a Proc" do let(:arg){ lambda{ :hello } } it { should be_a(TupleExpression) } specify{ subject.evaluate(handle).should eql(:hello) subject.source.should be_nil } end end describe "from_argv" do subject{ TupleExpression.from_argv(argv).evaluate(handle) } describe "with a String" do let(:argv){ %w{true} } it{ should eql(true) } end describe "with two String" do let(:argv){ %w{hello world} } specify{ lambda{subject}.should raise_error(ArgumentError) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alf-0.10.1 | spec/unit/types/test_tuple_expression.rb |
alf-0.10.0 | spec/unit/types/test_tuple_expression.rb |