Sha256: 505d0ffd084c0522cbf65a40ef1cf4b179e03af7761912f8d7131f3c06487f01
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'type_check_helper' module Alf module Algebra describe Matching, 'type_check' do subject{ op.type_check } context 'when ok' do let(:op){ matching(suppliers, suppliers) } it{ should eq(op.heading) } end context 'when nothing in common' do let(:right){ an_operand.with_heading(foo: Integer) } let(:left){ an_operand.with_heading(bar: String) } let(:op){ matching(left, right) } it{ should eq(op.heading) } end context 'when heading mismatch' do let(:right){ an_operand.with_heading(sid: Integer) } let(:left){ an_operand.with_heading(sid: String) } let(:op){ matching(left, right) } context 'when strict' do subject{ op.type_check(strict: true) } it 'should raise an error' do lambda{ subject }.should raise_error(TypeCheckError, /heading mismatch/) end end context 'when not strict' do subject{ op.type_check } it 'should not raise an error' do subject.should eq(op.heading) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alf-core-0.15.0 | spec/unit/alf-algebra/operator/matching/test_type_check.rb |