Sha256: 1ea8fcd63b9934a39fbc3da4707ada7fb4b96ca2c47e27c309199647d082d9ff
Contents?: true
Size: 817 Bytes
Versions: 4
Compression:
Stored size: 817 Bytes
Contents
RSpec.describe Operations::Implication do subject(:operation) { Operations::Implication.new(left, right) } include_context 'predicates' let(:left) { Rule::Predicate.new(int?) } let(:right) { Rule::Predicate.new(gt?).curry(18) } describe '#call' do it 'calls left and right' do expect(operation.('19')).to be_success expect(operation.(19)).to be_success expect(operation.(18)).to be_failure end end describe '#to_ast' do it 'returns ast' do expect(operation.to_ast).to eql( [:implication, [[:predicate, [:int?, [[:input, Undefined]]]], [:predicate, [:gt?, [[:num, 18], [:input, Undefined]]]]]] ) end end describe '#to_s' do it 'returns string representation' do expect(operation.to_s).to eql('int? THEN gt?(18)') end end end
Version data entries
4 entries across 4 versions & 1 rubygems