Sha256: 034baf4fc44795e87cfe25fe0de199e16132aafc9b0a723ee8a52a79947faf3b

Contents?: true

Size: 755 Bytes

Versions: 7

Compression:

Stored size: 755 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe SQL::Generator::Identifier, '#visit_identifier' do
  subject { object.visit_identifier(identifier) }

  let(:described_class) { Class.new(SQL::Generator::Visitor) { include SQL::Generator::Identifier } }
  let(:object)          { described_class.new                                                       }

  context 'with an identifier containing no quotes' do
    let(:identifier) { 'users' }

    it_should_behave_like 'a generated SQL expression'

    its(:to_s) { should eql('"users"') }
  end

  context 'with an identifier containing quotes' do
    let(:identifier) { 'users"name' }

    it_should_behave_like 'a generated SQL expression'

    its(:to_s) { should eql('"users""name"') }
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
axiom-sql-generator-0.2.0 spec/unit/axiom/sql/generator/identifier/visit_identifier_spec.rb
axiom-sql-generator-0.1.0 spec/unit/axiom/sql/generator/identifier/visit_identifier_spec.rb
veritas-sql-generator-0.0.7 spec/unit/veritas/sql/generator/identifier/visit_identifier_spec.rb
veritas-sql-generator-0.0.6 spec/unit/veritas/sql/generator/identifier/visit_identifier_spec.rb
veritas-sql-generator-0.0.5 spec/unit/veritas/sql/generator/identifier/visit_identifier_spec.rb
veritas-sql-generator-0.0.4 spec/unit/veritas/sql/generator/identifier/visit_identifier_spec.rb
veritas-sql-generator-0.0.3 spec/unit/veritas/sql/generator/identifier/visit_identifier_spec.rb