Sha256: 31467db6784b707e81eb986443741e59ee360b0a01763f9dda5b711fc51f01e7

Contents?: true

Size: 826 Bytes

Versions: 7

Compression:

Stored size: 826 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  before do
    Object.class_eval { remove_const(:NamedClass) if const_defined?(:NamedClass) }
    class ::NamedClass; end
  end

  context 'with a named class' do
    let(:klass) { NamedClass.freeze }

    it_should_behave_like 'a generated SQL expression'

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

  context 'with an anonymous class' do
    let(:klass) { described_class }

    it_should_behave_like 'a generated SQL expression'

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