Sha256: 7fcaea4fbc3490ebf67800cc443ee15b5aa4a77f4ad6e8613b9210d0a3113e84

Contents?: true

Size: 721 Bytes

Versions: 74

Compression:

Stored size: 721 Bytes

Contents

require 'spec_helper'

describe Acfs::Model::Attributes::Boolean do
  subject { Acfs::Model::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

74 entries across 74 versions & 1 rubygems

Version Path
acfs-0.30.0.1.b260 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.30.0 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.29.1.1.b259 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.29.1.1.b257 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.29.1 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.29.0.1.b256 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.29.0.1.b254 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.29.0 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.28.0.1.b253 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.28.0.1.b249 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.28.0 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.27.0.1.b248 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.27.0.1.b244 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.27.0 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.26.0.1.b243 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.26.0.1.b242 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.26.0 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.25.0.1.b232 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.25.0.1.b229 spec/acfs/model/attributes/boolean_spec.rb
acfs-0.25.0.1.b228 spec/acfs/model/attributes/boolean_spec.rb