Sha256: 69f7e302599642657bed2b59e4fe263fe19fed2b3a1c18fcbe53c46581825bc3

Contents?: true

Size: 1.36 KB

Versions: 20

Compression:

Stored size: 1.36 KB

Contents

require 'abstract_unit'
require 'fixtures/reference_type'
require 'fixtures/reference_code'

class CompositeArraysTest < Test::Unit::TestCase

  def test_new_primary_keys
    keys = CompositePrimaryKeys::CompositeKeys.new
    assert_not_nil keys
    assert_equal '', keys.to_s
    assert_equal '', "#{keys}"
  end

  def test_initialize_primary_keys
    keys = CompositePrimaryKeys::CompositeKeys.new([1,2,3])
    assert_not_nil keys
    assert_equal '1,2,3', keys.to_s
    assert_equal '1,2,3', "#{keys}"
  end
  
  def test_to_composite_keys
    keys = [1,2,3].to_composite_keys
    assert_equal CompositePrimaryKeys::CompositeKeys, keys.class
    assert_equal '1,2,3', keys.to_s
  end

  def test_new_ids
    keys = CompositePrimaryKeys::CompositeIds.new
    assert_not_nil keys
    assert_equal '', keys.to_s
    assert_equal '', "#{keys}"
  end

  def test_initialize_ids
    keys = CompositePrimaryKeys::CompositeIds.new([1,2,3])
    assert_not_nil keys
    assert_equal '1,2,3', keys.to_s
    assert_equal '1,2,3', "#{keys}"
  end
  
  def test_to_composite_ids
    keys = [1,2,3].to_composite_ids
    assert_equal CompositePrimaryKeys::CompositeIds, keys.class
    assert_equal '1,2,3', keys.to_s
  end
  
  def test_flatten
    keys = [CompositePrimaryKeys::CompositeIds.new([1,2,3]), CompositePrimaryKeys::CompositeIds.new([4,5,6])]
    assert_equal 6, keys.flatten.size
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
mingusbabcock-composite_primary_keys-2.2.2.1 test/test_composite_arrays.rb
tyler-composite_primary_keys-1.1.0 test/test_composite_arrays.rb
tyler-composite_primary_keys-1.1.1 test/test_composite_arrays.rb
tyler-composite_primary_keys-1.1.2 test/test_composite_arrays.rb
tyler-composite_primary_keys-1.1.3 test/test_composite_arrays.rb
tyler-composite_primary_keys-1.1.4 test/test_composite_arrays.rb
composite_primary_keys-1.0.0 test/test_composite_arrays.rb
composite_primary_keys-1.0.1 test/test_composite_arrays.rb
composite_primary_keys-1.0.10 test/test_composite_arrays.rb
composite_primary_keys-1.0.2 test/test_composite_arrays.rb
composite_primary_keys-1.0.3 test/test_composite_arrays.rb
composite_primary_keys-1.0.7 test/test_composite_arrays.rb
composite_primary_keys-2.2.1 test/test_composite_arrays.rb
composite_primary_keys-2.2.2 test/test_composite_arrays.rb
composite_primary_keys-1.0.6 test/test_composite_arrays.rb
composite_primary_keys-1.0.5 test/test_composite_arrays.rb
composite_primary_keys-1.0.4 test/test_composite_arrays.rb
composite_primary_keys-2.2.0 test/test_composite_arrays.rb
composite_primary_keys-1.1.0 test/test_composite_arrays.rb
composite_primary_keys-1.0.8 test/test_composite_arrays.rb