Sha256: 190a182765fb17603c5c8fb03b495edf507202a468c15579567edcaa4721e971

Contents?: true

Size: 490 Bytes

Versions: 4

Compression:

Stored size: 490 Bytes

Contents

require 'spec_helper'

describe Hari::Entity::Serialization::Float do

  describe '.serialize, .desserialize' do
    it 'converts to float' do
      subject.serialize(4237.55).should == 4237.55
      subject.serialize('4237.55').should == 4237.55
      subject.serialize('4237').should == 4237.0
    end

    context 'when an invalid value is desserialized' do
      it 'raises an error' do
        expect { subject.desserialize('not a float') }.to raise_error
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hari-0.0.5 spec/hari/entity/serialization/float_spec.rb
hari-0.0.4 spec/hari/entity/serialization/float_spec.rb
hari-0.0.3 spec/hari/entity/serialization/float_spec.rb
hari-0.0.1 spec/hari/entity/serialization/float_spec.rb