spec/calculator_spec.rb in dentaku-0.1.2 vs spec/calculator_spec.rb in dentaku-0.1.3
- old
+ new
@@ -48,9 +48,14 @@
it 'should accept strings or symbols for binding keys' do
calculator.evaluate('foo * 2', :foo => 2).should eq(4)
calculator.evaluate('foo * 2', 'foo' => 4).should eq(8)
end
+ it 'should compare string literals with string variables' do
+ calculator.evaluate('fruit = "apple"', :fruit => 'apple').should be_true
+ calculator.evaluate('fruit = "apple"', :fruit => 'pear').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