Sha256: 17e179460897a52a24a38ba4a2f8cc83281f1b6f6a32247ee55cd93d179b1755

Contents?: true

Size: 649 Bytes

Versions: 5

Compression:

Stored size: 649 Bytes

Contents

require 'spec_helper'
module Alf
  module Sql
    class Processor
      describe Rename, "on_select_item" do

        subject{ Rename.new(Renaming[a: :x], Builder.new).on_select_item(expr) }

        context 'when included' do
          let(:expr){ select_item('a', 'a') }

          it{ should eq(select_item('a', 'x')) }
        end

        context 'when already a renaming' do
          let(:expr){ select_item('b', 'a') }

          it{ should eq(select_item('b', 'x')) }
        end

        context 'when not matching' do
          let(:expr){ select_item('a', 'y') }

          it{ should be(expr) }
        end

      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alf-sql-0.16.3 spec/processor/rename/test_on_select_item.rb
alf-sql-0.16.2 spec/processor/rename/test_on_select_item.rb
alf-sql-0.16.1 spec/processor/rename/test_on_select_item.rb
alf-sql-0.16.0 spec/processor/rename/test_on_select_item.rb
alf-sql-0.15.0 spec/processor/rename/test_on_select_item.rb