Sha256: fd4fdfecc3b410b1f31ea1bdf8a92871e1adc61db83659c158578b8f830bc398

Contents?: true

Size: 1.36 KB

Versions: 4

Compression:

Stored size: 1.36 KB

Contents

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

class CompositeArraysTest < ActiveSupport::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

4 entries across 4 versions & 2 rubygems

Version Path
kovyrin-composite_primary_keys-2.3.2 test/test_composite_arrays.rb
composite_primary_keys-2.3.5.1 test/test_composite_arrays.rb
composite_primary_keys-2.3.5 test/test_composite_arrays.rb
composite_primary_keys-2.3.2 test/test_composite_arrays.rb