Sha256: ec4f0b59601613e37750a33afae7593ab09b05a7c8bb511951dd87317eb001cc

Contents?: true

Size: 808 Bytes

Versions: 14

Compression:

Stored size: 808 Bytes

Contents

# Test facets/association.rb

require 'facets/association.rb'

require 'test/unit'

class TC_Associations < Test::Unit::TestCase

  def setup
    @complex_hierarchy = [
      'parent' >> 'child',
      'childless',
      'another_parent' >> [
        'subchildless',
        'subparent' >> 'subchild'
      ]
    ]
  end

  def test_ohash
    k,v = [],[]
    ohash = [ 'A' >> '3', 'B' >> '2', 'C' >> '1' ]
    ohash.each { |e1,e2| k << e1 ; v << e2 }
    assert_equal( ['A','B','C'], k )
    assert_equal( ['3','2','1'], v )
  end

  def test_complex
    complex = [ 'Drop Menu' >> [ 'Button 1', 'Button 2', 'Button 3' ], 'Help' ]
    assert_equal( 'Drop Menu', complex[0].index )
  end

  def test_associations
    complex = [ :a >> :b, :a >> :c ]
    assert_equal( [ :b, :c ], :a.associations )
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
facets-2.6.0 test/more/test_association.rb
facets-2.2.0 test/unit/test_association.rb
facets-2.2.1 test/unit/test_association.rb
facets-2.3.0 test/class/test_association.rb
facets-2.4.0 test/test_association.rb
facets-2.1.3 test/unit/test_association.rb
facets-2.4.1 test/test_association.rb
facets-2.4.3 test/more/test_association.rb
facets-2.4.4 test/more/test_association.rb
facets-2.4.2 test/more/test_association.rb
facets-2.5.0 test/more/test_association.rb
facets-2.5.1 test/more/test_association.rb
facets-2.4.5 test/more/test_association.rb
facets-2.5.2 test/more/test_association.rb