Sha256: ccb8fdd0e65da22ffe45366d25eed599d06d1573e2b55e200fd981196f46f272
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' require 'inactive_support/hash/delete_blank' describe Hash do describe "#delete_blank" do it 'deletes nils' do initial = { id: 1, name: nil } expected = { id: 1 } initial.delete_blank.should eq expected end it 'deletes empty strings' do initial = { id: 1, name: "" } expected = { id: 1 } initial.delete_blank.should eq expected end it 'preserves false values' do initial = { id: 1, name: false } expected = { id: 1, name: false } initial.delete_blank.should eq expected end it 'deletes empty arrays' do initial = { id: 1, name: [] } expected = { id: 1 } initial.delete_blank.should eq expected end it 'deletes empty hashes' do initial = { id: 1, name: {} } expected = { id: 1 } initial.delete_blank.should eq expected end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
inactive_support-1.0.0 | spec/lib/hash_spec.rb |
inactive_support-0.1.0 | spec/lib/hash_spec.rb |