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

Version Path
poolparty-1.6.9 test/lib/core/array_test.rb
poolparty-1.6.8 test/lib/core/array_test.rb
poolparty-1.6.7 test/lib/core/array_test.rb
poolparty-1.6.6 test/lib/core/array_test.rb
poolparty-1.6.5 test/lib/core/array_test.rb
poolparty-1.6.4 test/lib/core/array_test.rb
poolparty-1.6.3 test/lib/core/array_test.rb
poolparty-1.6.2 test/lib/core/array_test.rb
poolparty-1.6.1 test/lib/core/array_test.rb
poolparty-1.6.0 test/lib/core/array_test.rb
poolparty-1.5.0 test/lib/core/array_test.rb
poolparty-1.4.8 test/lib/core/array_test.rb
poolparty-1.4.7 test/lib/core/array_test.rb
poolparty-1.4.6 test/lib/core/array_test.rb
poolparty-1.4.5 test/lib/core/array_test.rb
poolparty-1.4.4 test/lib/core/array_test.rb
poolparty-1.4.3 test/lib/core/array_test.rb
poolparty-1.4.2 test/lib/core/array_test.rb
poolparty-1.4.1 test/lib/core/array_test.rb
poolparty-1.4.0 test/lib/core/array_test.rb