Sha256: 3d2b4e1b11d58faf29761e15c569d9a2ee4239f0dad55f0a878487d8aba25269

Contents?: true

Size: 827 Bytes

Versions: 1

Compression:

Stored size: 827 Bytes

Contents

require 'compiler_helper'
module Alf
  module Sequel
    describe Compiler, "join" do

      subject{ compile(expr) }

      context 'when the operand is fully compilable' do
        let(:expr){ join(suppliers, supplies) }

        specify do
          subject.sql.should eq("SELECT * FROM (SELECT * FROM (SELECT * FROM `suppliers` AS 't1') AS 't1' INNER JOIN (SELECT * FROM `supplies` AS 't2') AS 't3' USING (`sid`)) AS 't3'")
        end
      end

      context 'when the left operand is a projection' do
        let(:expr){ join(project(suppliers, [:sid]), supplies) }

        specify do
          subject.sql.should eq("SELECT * FROM (SELECT * FROM (SELECT `t1`.`sid` FROM `suppliers` AS 't1') AS 't1' INNER JOIN (SELECT * FROM `supplies` AS 't2') AS 't3' USING (`sid`)) AS 't3'")
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-sequel-0.14.0 spec/compiler/test_join.rb