spec/expressive_spec.rb in expressive-0.0.10 vs spec/expressive_spec.rb in expressive-0.0.11
- old
+ new
@@ -35,10 +35,12 @@
it { Expressive.run("(+ 4 2)").should eql 6.0 }
it { Expressive.run("(- 4 2)").should eql 2.0 }
it { Expressive.run("(* 4 2)").should eql 8.0 }
it { Expressive.run("(/ 4 2)").should eql 2.0 }
it { Expressive.run("(sum 1 2 3)").should eql 6.0 }
+ it { Expressive.run("(sum )").should eql 0 }
+ it { Expressive.run("(- (sum 1 5 7) 3)").should eql 10.0}
end
describe "understands comparisson" do
it { Expressive.run("(= 4 2)").should eql false }
it { Expressive.run("(= 4 4)").should eql true }
@@ -128,10 +130,10 @@
Expressive.run('(lookup users "x_current")', @scope).should eql @user2
Expressive.run('(lookup users "user1")', @scope).should eql @user1
end
it "will set multiple values based on results of a lookup" do
@owned_by_ext_value = Expressive::ExtendedValue.new(:x_owned_by, @scope)
- @owned_by_ext_value.setter = Proc.new do |value, scope|
+ @owned_by_ext_value.setter = Proc.new do |value, scope|
scope["owned_by_id"] = value.id
scope["owned_by_type"] = value.class.to_s
end
Expressive.run('(set x_owned_by (lookup users "x_current"))', @scope)