Sha256: 6c35ff08e23a3b49789a6bc63781d1f5777b236ff41c4a69af9c57620b4f64c3

Contents?: true

Size: 601 Bytes

Versions: 87

Compression:

Stored size: 601 Bytes

Contents

require 'spec_helper'

describe Acfs::Model::Attributes::Float do
  let(:model) { Class.new.tap { |c| c.send :include, Acfs::Model }}
  subject { Acfs::Model::Attributes::Float.new }

  describe 'cast' do
    it 'should return same object, if obj is already of float class' do
      expect(subject.cast(1.3)).to be == 1.3
    end

    it 'should return parsed object, if obj is of Fixnum class' do
      expect(subject.cast(7)).to be == 7.0
    end

    it 'should return parsed object, if obj is of String class containing a float' do
      expect(subject.cast('1.7')).to be == 1.7
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
acfs-0.25.0.1.b227 spec/acfs/model/attributes/float_spec.rb
acfs-0.25.0.1.b226 spec/acfs/model/attributes/float_spec.rb
acfs-0.25.0.1.b225 spec/acfs/model/attributes/float_spec.rb
acfs-0.25.0.1.b223 spec/acfs/model/attributes/float_spec.rb
acfs-0.25.0.1.b221 spec/acfs/model/attributes/float_spec.rb
acfs-0.25.0.1.b217 spec/acfs/model/attributes/float_spec.rb
acfs-0.25.0 spec/acfs/model/attributes/float_spec.rb
acfs-0.24.0.1.b216 spec/acfs/model/attributes/float_spec.rb
acfs-0.24.0.1.b214 spec/acfs/model/attributes/float_spec.rb
acfs-0.24.0.1.b212 spec/acfs/model/attributes/float_spec.rb
acfs-0.24.0.b210 spec/acfs/model/attributes/float_spec.rb
acfs-0.24.0 spec/acfs/model/attributes/float_spec.rb
acfs-0.23.2.b209 spec/acfs/model/attributes/float_spec.rb
acfs-0.23.2.b208 spec/acfs/model/attributes/float_spec.rb
acfs-0.23.2.b206 spec/acfs/model/attributes/float_spec.rb
acfs-0.23.2.b205 spec/acfs/model/attributes/float_spec.rb
acfs-0.23.2.b204 spec/acfs/model/attributes/float_spec.rb
acfs-0.23.2.b203 spec/acfs/model/attributes/float_spec.rb
acfs-0.23.2.b200 spec/acfs/model/attributes/float_spec.rb
acfs-0.23.2.b199 spec/acfs/model/attributes/float_spec.rb