Sha256: 0d2abc179af876535a037da5e30a8d9c2b9bd808303aae83dcbdb8041a945440
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require 'spec_helper' module Alf module Support describe TupleScope do let(:scope){ TupleScope.new } it "should install methods properly" do scope.__set_tuple(:hello => "a", :world => "b") scope.respond_to?(:hello).should be_true scope.respond_to?(:world).should be_true end it "should behave correctly" do scope.__set_tuple(:hello => "a", :world => "b") scope.hello.should == "a" scope.world.should == "b" scope.__set_tuple(:hello => "c", :world => "d") scope.hello.should == "c" scope.world.should == "d" end it "should allow instance evaluating on exprs" do scope.__set_tuple(:tested => 1) scope.evaluate{ tested < 1 }.should be_false end it "should support an attribute called :path" do scope.__set_tuple(:path => 1) scope.evaluate{ path < 1 }.should be_false end it "should support calling Tuple and Relation" do scope.__set_tuple(:path => 1) scope.evaluate{ Tuple(sid: path) }.should eq(Tuple(sid: 1)) scope.evaluate{ Relation(sid: path) }.should eq(Relation(sid: 1)) end it "should support being converted to Relation" do scope.__set_tuple(:path => 1) Relation(scope).should eq(Relation(path: 1)) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alf-core-0.15.0 | spec/unit/alf-support/test_tuple_scope.rb |