Sha256: ea3b2152971e3ba2d47bf1b7eb81758c9fd1dd32b39fee3bc2f05c2d35315b78
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
# encoding: utf-8 require 'spec_helper' [ :join, :+ ].each do |method| describe Algebra::Join::Methods, "##{method}" do let(:described_class) { Relation } let(:object) { described_class.new([ [ :id, Integer ], [ :name, String ] ], LazyEnumerable.new([ [ 1, 'Dan Kubb' ], [ 2, 'Dan Kubb' ] ])) } context 'without a block' do subject { object.send(method, other) } let(:other) { described_class.new([ [ :id, Integer ], [ :age, Integer ] ], LazyEnumerable.new([ [ 1, 35 ] ])) } it { should be_instance_of(Algebra::Join) } end context 'with a block' do subject { object.send(method, other, &block) } let(:other) { described_class.new([ Attribute::Boolean.new(:active) ], [ [ true ] ]) } let(:block) do lambda do |relation| relation[:id].eq(1).and(relation[:active].eq(true)) end end it { should be_instance_of(Algebra::Restriction) } it 'restricts a product' do should == [ [ 1, 'Dan Kubb', true ] ] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | spec/unit/axiom/algebra/join/methods/join_spec.rb |