fix join dependency spec
This commit is contained in:
parent
99cbc190ad
commit
dbd3eab06d
|
@ -8,8 +8,8 @@ module Polyamorous
|
||||||
|
|
||||||
specify { expect(subject.send(:join_root).drop(1).size)
|
specify { expect(subject.send(:join_root).drop(1).size)
|
||||||
.to eq(2) }
|
.to eq(2) }
|
||||||
specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
|
specify { expect(subject.send(:join_root).drop(1).map(&:join_type).uniq)
|
||||||
.to be_all { Polyamorous::InnerJoin } }
|
.to eq [Polyamorous::InnerJoin] }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with has_many :through association' do
|
context 'with has_many :through association' do
|
||||||
|
@ -38,8 +38,8 @@ module Polyamorous
|
||||||
.to eq 2 }
|
.to eq 2 }
|
||||||
specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
|
specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
|
||||||
.to eq [Polyamorous::OuterJoin, Polyamorous::OuterJoin] }
|
.to eq [Polyamorous::OuterJoin, Polyamorous::OuterJoin] }
|
||||||
specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
|
specify { expect(subject.send(:join_root).drop(1).map(&:join_type).uniq)
|
||||||
.to be_all { Polyamorous::OuterJoin } }
|
.to eq [Polyamorous::OuterJoin] }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with polymorphic belongs_to join' do
|
context 'with polymorphic belongs_to join' do
|
||||||
|
@ -59,8 +59,19 @@ module Polyamorous
|
||||||
|
|
||||||
specify { expect(subject.send(:join_root).drop(1).size)
|
specify { expect(subject.send(:join_root).drop(1).size)
|
||||||
.to eq 2 }
|
.to eq 2 }
|
||||||
specify { expect(subject.send(:join_root).drop(1).map(&:join_type))
|
specify { expect(subject.send(:join_root).drop(1).map(&:join_type).uniq)
|
||||||
.to be_all { Polyamorous::InnerJoin } }
|
.to eq [Polyamorous::InnerJoin] }
|
||||||
|
specify { expect(subject.send(:join_root).drop(1).first.table_name)
|
||||||
|
.to eq 'people' }
|
||||||
|
specify { expect(subject.send(:join_root).drop(1)[1].table_name)
|
||||||
|
.to eq 'comments' }
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with polymorphic belongs_to join and nested join' do
|
||||||
|
subject { new_join_dependency Note,
|
||||||
|
new_join(:notable, :outer, Person) => :comments }
|
||||||
|
specify { expect(subject.send(:join_root).drop(1).size).to eq 2 }
|
||||||
|
specify { expect(subject.send(:join_root).drop(1).map(&:join_type)).to eq [Polyamorous::OuterJoin, Polyamorous::InnerJoin] }
|
||||||
specify { expect(subject.send(:join_root).drop(1).first.table_name)
|
specify { expect(subject.send(:join_root).drop(1).first.table_name)
|
||||||
.to eq 'people' }
|
.to eq 'people' }
|
||||||
specify { expect(subject.send(:join_root).drop(1)[1].table_name)
|
specify { expect(subject.send(:join_root).drop(1)[1].table_name)
|
||||||
|
|
Loading…
Reference in New Issue