Sha256: 1018c3d67b31a1cd3d67d2663444edf53c882051bb2a20e783e139b58919decf

Contents?: true

Size: 584 Bytes

Versions: 5

Compression:

Stored size: 584 Bytes

Contents

require 'spec_helper'

describe SafeCookies::Util do
  
  describe '.except!' do
    
    before do
      @hash = { 'a' => 1, 'ab' => 2, 'b' => 3 }
    end

    it 'deletes the given keys from the original hash' do
      SafeCookies::Util.except!(@hash, 'a')
      @hash.should == { 'ab' => 2, 'b' => 3 }
    end
    
    it 'deletes all keys that match the regex' do
      SafeCookies::Util.except!(@hash, /b/)
      @hash.should == { 'a' => 1 }
    end
    
    it 'returns the original hash' do
      SafeCookies::Util.except!(@hash, /(?!)/).should == @hash
    end
    
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
safe_cookies-0.2.2 spec/util_spec.rb
safe_cookies-0.2.1 spec/util_spec.rb
safe_cookies-0.2.0 spec/util_spec.rb
safe_cookies-0.1.7 spec/util_spec.rb
safe_cookies-0.1.6 spec/util_spec.rb