Sha256: 87d96b29a78b7f02ec7ac962123a06e328d91af60d6414479983e102a0293c7f

Contents?: true

Size: 742 Bytes

Versions: 5

Compression:

Stored size: 742 Bytes

Contents

require 'mida/datatype'

describe Mida::DataType::Integer do

  it '#parse should raise an exception if not a number' do
    test = lambda {Mida::DataType::Integer.parse('hello')}
    test.should raise_error(ArgumentError)
  end

  it '#parse should raise an exception if not an integer' do
    test = lambda {Mida::DataType::Integer.parse('3.14')}
    test.should raise_error(ArgumentError)
  end

  it '#parse should raise an exception if value is empty' do
    test = lambda {Mida::DataType::Integer.parse('')}
    test.should raise_error(ArgumentError)
  end

  it '#parse should accept a valid number' do
    integer_text = '3'
    integer = Mida::DataType::Integer.parse(integer_text)
    integer.to_s.should == integer_text
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mida-0.3.9 spec/datatype/integer_spec.rb
mida-0.3.8 spec/datatype/integer_spec.rb
mida-0.3.7 spec/datatype/integer_spec.rb
mida-0.3.6 spec/datatype/integer_spec.rb
mida-0.3.3 spec/datatype/integer_spec.rb