Sha256: 784ebbc7d3669851f7e002b775c40cb73d12963f69c178bbada23879316651dd
Contents?: true
Size: 761 Bytes
Versions: 20
Compression:
Stored size: 761 Bytes
Contents
require "#{File.dirname(__FILE__)}/../../test_helper" class ArrayTest < Test::Unit::TestCase def setup @arr = %w(a b c d) @hash_arr = [ {:name => "peter", :occupation => "computer scientist"}, {:name => "al", :occupation => "computer scientist"}, {:name => "matt", :occupation => "doctor"}, {:name => "jenna", :occupation => "lawyer"} ] end def test_be_able_to_select_with_hash assert_equal @hash_arr.select_with_hash(:name => "matt").first[:occupation], "doctor" assert_equal @hash_arr.select_with_hash(:occupation => "computer scientist").first[:name], "peter" assert @hash_arr.select_with_hash(:occupation => "matt").empty? end end
Version data entries
20 entries across 20 versions & 1 rubygems