Sha256: 57df81652c450925cdf9c17fdc078f82263db1fea320c54273ca84e3e360876d
Contents?: true
Size: 776 Bytes
Versions: 1
Compression:
Stored size: 776 Bytes
Contents
require 'test/unit' require File.join(File.dirname(__FILE__),'..','lib','subelsky_enhancements','hash') class TestHash < Test::Unit::TestCase def hash @hash ||= { :a => 1, :b => 2, :c => 3, :d => 4 } end def test_except_with_one_key assert_equal({ :a => 1, :b => 2, :d => 4 }, hash.except(:c)) end def test_except_with_multiple_keys assert_equal({ :b => 2, :c => 3 }, hash.except(:a,:d)) end def test_except_with_absent_key assert_equal(hash, hash.except(:e)) end def test_only_with_one_key assert_equal({ :a => 1 }, hash.only(:a)) end def test_only_with_multiple_keys assert_equal({ :b => 2, :c => 3, :d => 4 }, hash.only(:b,:c,:d)) end def test_only_with_absent_key assert_equal({}, hash.only(:e)) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
subelsky_enhancements-1.0.0 | test/hash_test.rb |