Sha256: 46bd60e0a7932668dfa55cce7c2193ac5e8728ade5eae9ae5ba97cdc0f66e2b7

Contents?: true

Size: 689 Bytes

Versions: 5

Compression:

Stored size: 689 Bytes

Contents

require 'spec_helper'
module Alf
  module Algebra
    describe Operand, "to_sql" do

      subject{ op.to_sql }

      context 'when to_cog does not support to_sql' do
        let(:op) { restrict(suppliers, city: 'London') }

        before do
          op.to_cog.should_not respond_to(:to_sql)
        end

        it{ should eq("SELECT t1.sid, t1.name, t1.status, t1.city FROM suppliers AS t1 WHERE t1.city = 'London'") }
      end

      context 'when to_cog does support to_sql' do
        let(:op) { restrict(suppliers, city: 'London') }

        before do
          def op.to_sql
            :foo
          end
        end

        it{ should eq(:foo) }
      end

    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-sql-0.16.3 spec/algebra/operand/test_to_sql.rb
alf-sql-0.16.2 spec/algebra/operand/test_to_sql.rb
alf-sql-0.16.1 spec/algebra/operand/test_to_sql.rb
alf-sql-0.16.0 spec/algebra/operand/test_to_sql.rb
alf-sql-0.15.0 spec/algebra/operand/test_to_sql.rb