Sha256: 2d6cc96cd551d9dcfb5d996f5c90523f1f1346b29334e98e55f114f7cc0b807a

Contents?: true

Size: 828 Bytes

Versions: 7

Compression:

Stored size: 828 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  context 'with an Integer' do
    let(:numeric) { 1 }

    it_should_behave_like 'a generated SQL expression'

    its(:to_s) { should eql('1') }
  end

  context 'with a Float' do
    let(:numeric) { 1.0 }

    it_should_behave_like 'a generated SQL expression'

    its(:to_s) { should eql('1.0') }
  end

  context 'with a BigDecimal' do
    let(:numeric) { BigDecimal('1.0') }

    it_should_behave_like 'a generated SQL expression'

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