Sha256: e1007c1ad66c6c8eded2c01d73efa9113aaeafe1f8efe28082ce8218cd306edd

Contents?: true

Size: 727 Bytes

Versions: 8

Compression:

Stored size: 727 Bytes

Contents

require 'spec_helper'

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

  describe 'cast' do
    it 'should preserve boolean values' do
      expect(subject.cast(false)).to eq false
      expect(subject.cast(true)).to eq true
    end

    it 'should cast TRUE_VALUES to true' do
      expect(subject.cast('yes')).to eq true
      expect(subject.cast('on')).to eq true
      expect(subject.cast('true')).to eq true
      expect(subject.cast('1')).to eq true
    end

    it 'should cast any other value to false' do
      expect(subject.cast('')).to eq false
      expect(subject.cast('wrong')).to eq false
      expect(subject.cast('random')).to eq false
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
acfs-0.45.0 spec/acfs/resource/attributes/boolean_spec.rb
acfs-0.44.0 spec/acfs/resource/attributes/boolean_spec.rb
acfs-0.43.2 spec/acfs/resource/attributes/boolean_spec.rb
acfs-0.43.1 spec/acfs/resource/attributes/boolean_spec.rb
acfs-0.43.0 spec/acfs/resource/attributes/boolean_spec.rb
acfs-1.0.0.dev.1.b305 spec/acfs/resource/attributes/boolean_spec.rb
acfs-1.0.0.dev.1.b298 spec/acfs/resource/attributes/boolean_spec.rb
acfs-1.0.0.dev.1.b297 spec/acfs/resource/attributes/boolean_spec.rb