spec/expressive_spec.rb in expressive-0.0.13 vs spec/expressive_spec.rb in expressive-0.0.14

- old
+ new

@@ -4,11 +4,11 @@ before(:each) do @scope = Expressive::TopLevel.new end describe "all_symbols" do - it { Expressive.all_symbols.should =~ %w(+ - * / = set sum get put post >= > < <= and or if date lookup) } + it { Expressive.all_symbols.should =~ %w(+ - * / = set sum get put post >= > < <= and or if date lookup round) } end describe "understands booleans" do it { Expressive.run("true").should eql true } it { Expressive.run("false").should eql false } @@ -149,9 +149,18 @@ @scope.add_lookup_function("account_reverse_login", account: "ea") do |options, login| "#{options[:account]}-#{login.reverse}" end Expressive.run('(lookup account_reverse_login "ijonas")', @scope).should eql "ea-sanoji" end + + it "should support multiple parameters to a lookup function" do + @scope.add_lookup_function("related_count") do |options, related_type, query_specs, last| + [related_type, query_specs.length, last] + end + + Expressive.run('(lookup related_count "matters" (1 2 3) 10)', @scope).should eql ['matters', 3, 10] + end + end describe "understands web-hook statements" do context "put" do it_should_behave_like "a webhook", :put