spec/calculator_spec.rb in dentaku-3.2.1 vs spec/calculator_spec.rb in dentaku-3.3.0
- old
+ new
@@ -77,10 +77,11 @@
end
describe 'evaluate!' do
it 'raises exception when formula has error' do
expect { calculator.evaluate!('1 + + 1') }.to raise_error(Dentaku::ParseError)
+ expect { calculator.evaluate!('(1 > 5) OR LEFT("abc", 1)') }.to raise_error(Dentaku::ParseError)
end
it 'raises unbound variable errors' do
expect { calculator.evaluate!('AND(a,b)') }.to raise_error(Dentaku::UnboundVariableError)
expect { calculator.evaluate!('IF(a, 1, 0)') }.to raise_error(Dentaku::UnboundVariableError)
@@ -147,9 +148,10 @@
expect(calculator.evaluate!('a[x+1]', x: 1)).to eq 3
end
it 'evaluates arrays' do
expect(calculator.evaluate([1, 2, 3])).to eq([1, 2, 3])
+ expect(calculator.evaluate!('{1,2,3}')).to eq([1, 2, 3])
end
end
describe 'dependencies' do
it "finds dependencies in a generic statement" do