Sha256: 1d1914ed107f409ac85f04f76aab3f81e7c47c101558e703776b2bdfa0dad426

Contents?: true

Size: 678 Bytes

Versions: 3

Compression:

Stored size: 678 Bytes

Contents

require 'mida/datatype'

describe Mida::DataType::Float do

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

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

  it '#extract? should return the input value as a Float if a floating point' do
    Mida::DataType::Float.extract("3.14").should == 3.14
  end

  it '#extract? should return the input value as a Float if a integer' do
    Mida::DataType::Float.extract("3").should == 3
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mida-0.3.2 spec/datatype/float_spec.rb
mida-0.3.1 spec/datatype/float_spec.rb
mida-0.3.0 spec/datatype/float_spec.rb