Sha256: 659643ccc1cb2ec79292bcd97d278428196a656374a6893c2a9f864a16c55cc4

Contents?: true

Size: 650 Bytes

Versions: 2

Compression:

Stored size: 650 Bytes

Contents

# encoding: utf-8

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')


include Piglet::Field


describe Literal do

  describe '#type' do
    it 'knows that the type of a string is chararray' do
      Literal.new("hello world").type.should eql(:chararray)
    end

    it 'knows that the type of an integer is int' do
      Literal.new(3).type.should eql(:int)
    end

    it 'knows that the type of a float is double' do
      Literal.new(3.14).type.should eql(:double)
    end
    
    it 'uses the specified type instead of the inferred' do
      Literal.new(3.14, :type => :float).type.should eql(:float)
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
piglet-0.3.0 spec/piglet/field/literal_spec.rb
piglet-0.2.5 spec/piglet/field/literal_spec.rb