diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/arel/engines/memory/integration/joins/cross_engine_spec.rb | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb b/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb index dd923ee6eb..4862300052 100644 --- a/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb +++ b/spec/arel/engines/memory/integration/joins/cross_engine_spec.rb @@ -14,17 +14,34 @@ module Arel .insert(@photos[:id] => 1, @photos[:user_id] => 1, @photos[:camera_id] => 6) \ .insert(@photos[:id] => 2, @photos[:user_id] => 2, @photos[:camera_id] => 42) end - - it 'joins across engines' do - @users \ - .join(@photos) \ - .on(@users[:id].eq(@photos[:user_id])) \ - .project(@users[:name], @photos[:camera_id]) \ - .let do |relation| - relation.call.should == [ - Row.new(relation, ['bryan', '6']), - Row.new(relation, ['emilio', '42']) - ] + + describe 'when the in memory relation is on the left' do + it 'joins across engines' do + @users \ + .join(@photos) \ + .on(@users[:id].eq(@photos[:user_id])) \ + .project(@users[:name], @photos[:camera_id]) \ + .let do |relation| + relation.call.should == [ + Row.new(relation, ['bryan', '6']), + Row.new(relation, ['emilio', '42']) + ] + end + end + end + + describe 'when the in memory relation is on the right' do + it 'joins across engines' do + @photos \ + .join(@users) \ + .on(@users[:id].eq(@photos[:user_id])) \ + .project(@users[:name], @photos[:camera_id]) \ + .let do |relation| + relation.call.should == [ + Row.new(relation, ['bryan', '6']), + Row.new(relation, ['emilio', '42']) + ] + end end end end |