Sha256: 6073f07ce051bd8220d046851f569172d0452f55aa51c112e803c99639ae1a4f

Contents?: true

Size: 734 Bytes

Versions: 7

Compression:

Stored size: 734 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe SQL::Generator::Literal, '#visit_string' do
  subject { object.visit_string(string) }

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

  context 'with a string containing no quotes' do
    let(:string) { 'string'.freeze }

    it_should_behave_like 'a generated SQL expression'

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

  context 'with a string containing quotes' do
    let(:string) { "string'name".freeze }

    it_should_behave_like 'a generated SQL expression'

    its(:to_s) { should eql("'string''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/literal/visit_string_spec.rb
axiom-sql-generator-0.1.0 spec/unit/axiom/sql/generator/literal/visit_string_spec.rb
veritas-sql-generator-0.0.7 spec/unit/veritas/sql/generator/literal/visit_string_spec.rb
veritas-sql-generator-0.0.6 spec/unit/veritas/sql/generator/literal/visit_string_spec.rb
veritas-sql-generator-0.0.5 spec/unit/veritas/sql/generator/literal/visit_string_spec.rb
veritas-sql-generator-0.0.4 spec/unit/veritas/sql/generator/literal/visit_string_spec.rb
veritas-sql-generator-0.0.3 spec/unit/veritas/sql/generator/literal/visit_string_spec.rb