Sha256: 2eadb9f10ccd830e01bc4a7dba83de5babe98b3bfb0f81c917cb63addcbf9c6e
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
require 'test_helper' class SignatureHashTest < Test::Unit::TestCase class SubString < String end context 'A SignatureHash' do subject do RubyLess::SignatureHash[ [1, 2] => 'one, two', [:x, String, String] => 'x_string_string' ] end should 'find values by hashing' do assert_equal 'one, two', subject[[1,2]] end should 'return nil on invalid keys' do assert_nil subject['hop'] end should 'find exact match' do assert_equal 'x_string_string', subject[[:x, String, String]] end should 'find subclass match' do assert_equal 'x_string_string', subject[[:x, SubString, String]] end should 'find subclass match at any position' do assert_equal 'x_string_string', subject[[:x, SubString, SubString]] assert_equal 'x_string_string', subject[[:x, String, SubString]] end should 'cache key on subclass match' do key = [:x, SubString, String] assert !subject.keys.include?(key) assert_equal 'x_string_string', subject[key] assert subject.keys.include?(key) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
rubyless-0.7.0 | test/signature_hash_test.rb |
rubyless-0.6.0 | test/signature_hash_test.rb |
rubyless-0.5.0 | test/signature_hash_test.rb |
rubyless-0.4.0 | test/signature_hash_test.rb |