Sha256: 55a355a478af5dfa15a9e8ca2005cdfa1040b7d7411b45ec2d2c0375e86bc1ff

Contents?: true

Size: 655 Bytes

Versions: 108

Compression:

Stored size: 655 Bytes

Contents

require File.dirname(__FILE__) + '/spec_helper'

describe "hash extentions" do
  it "limit_to_keys should limit keys in hash" do
    h = {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
    h.limit_to_keys([:bro1,:bro2]).should == {:bro1=>'me',:bro2=>'rob'}
    h.should == {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
  end

  it "limit_to_keys! should destructively limit keys in hash" do
    h = {:bro1=>'me',:bro2=>'rob',:bro3=>'eric'}
    h.limit_to_keys!([:bro1,:bro2]).should == {:bro1=>'me',:bro2=>'rob'}
    h.should == {:bro1=>'me',:bro2=>'rob'}
  end

  it "soft deletes" do
    h = {:dan=>1,:eric=>2}
    h.soft_delete(:dan).should == {:eric=>2}
  end
end

Version data entries

108 entries across 108 versions & 1 rubygems

Version Path
fossil-0.5.26 spec/hash_extentions_spec.rb
fossil-0.5.25 spec/hash_extentions_spec.rb
fossil-0.5.24 spec/hash_extentions_spec.rb
fossil-0.5.23 spec/hash_extentions_spec.rb
fossil-0.5.22 spec/hash_extentions_spec.rb
fossil-0.5.21 spec/hash_extentions_spec.rb
fossil-0.5.20 spec/hash_extentions_spec.rb
fossil-0.5.19 spec/hash_extentions_spec.rb
fossil-0.5.18 spec/hash_extentions_spec.rb
fossil-0.5.17 spec/hash_extentions_spec.rb
fossil-0.5.16 spec/hash_extentions_spec.rb
fossil-0.5.15 spec/hash_extentions_spec.rb
fossil-0.5.14 spec/hash_extentions_spec.rb
fossil-0.5.13 spec/hash_extentions_spec.rb
fossil-0.5.12 spec/hash_extentions_spec.rb
fossil-0.5.11 spec/hash_extentions_spec.rb
fossil-0.5.10 spec/hash_extentions_spec.rb
fossil-0.5.9 spec/hash_extentions_spec.rb
fossil-0.5.8 spec/hash_extentions_spec.rb
fossil-0.5.7 spec/hash_extentions_spec.rb