spec/calculator_spec.rb in dentaku-0.2.10 vs spec/calculator_spec.rb in dentaku-0.2.11
- old
+ new
@@ -66,9 +66,15 @@
it 'should do case-sensitive comparison' do
calculator.evaluate('fruit = "Apple"', :fruit => 'apple').should be_false
calculator.evaluate('fruit = "Apple"', :fruit => 'Apple').should be_true
end
+ it 'should allow binding logical values' do
+ calculator.evaluate('some_boolean AND 7 > 5', :some_boolean => true).should be_true
+ calculator.evaluate('some_boolean AND 7 < 5', :some_boolean => true).should be_false
+ calculator.evaluate('some_boolean AND 7 > 5', :some_boolean => false).should be_false
+ end
+
describe 'functions' do
it 'should include IF' do
calculator.evaluate('if (foo < 8, 10, 20)', :foo => 2).should eq(10)
calculator.evaluate('if (foo < 8, 10, 20)', :foo => 9).should eq(20)
end