Sha256: b8b1942487234463b76e3df90b9685979e832a513afb8d4e6d89b6c88519e370

Contents?: true

Size: 474 Bytes

Versions: 3

Compression:

Stored size: 474 Bytes

Contents

require 'spec_helper'

describe Acfs::Resource::Attributes::Integer do
  subject { Acfs::Resource::Attributes::Integer.new }

  describe 'cast' do
    it 'should cast integer strings' do
      expect(subject.cast('123')).to eq 123
    end

    it 'should cast empty string (backward compatibility)' do
      expect(subject.cast('')).to eq 0
    end

    it 'should not cast invalid integers' do
      expect { subject.cast 'abc' }.to raise_error TypeError
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
acfs-0.45.0 spec/acfs/resource/attributes/integer_spec.rb
acfs-0.44.0 spec/acfs/resource/attributes/integer_spec.rb
acfs-0.43.2 spec/acfs/resource/attributes/integer_spec.rb