Sha256: 9accf91f5ff9a49d92e5df8ee19c19a2584778972c51aca55259648bad5dd217

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

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

class DeleteTest < Test::Unit::TestCase
  fixtures :reference_types, :reference_codes

  CLASSES = {
    :single => {
      :class => ReferenceType,
      :primary_keys => :reference_type_id,
    },
    :dual   => { 
      :class => ReferenceCode,
      :primary_keys => [:reference_type_id, :reference_code],
    },
  }
  
  def setup
    super
    self.class.classes = CLASSES
  end
  
  def test_destroy_one
    testing_with do
      #assert @first.destroy
      assert true
    end
  end
  
  def test_destroy_one_via_class
    testing_with do
      assert @klass.destroy(*@first.id)
    end
  end
  
  def test_destroy_one_alone_via_class
    testing_with do
      assert @klass.destroy(@first.id)
    end
  end
  
  def test_delete_one
    testing_with do
      assert @klass.delete(*@first.id) if composite?
    end
  end
  
  def test_delete_one_alone
    testing_with do
      assert @klass.delete(@first.id)
    end
  end
  
  def test_delete_many
    testing_with do
      to_delete = @klass.find(:all)[0..1]
      assert_equal 2, to_delete.length
    end
  end
  
  def test_delete_all
    testing_with do
      @klass.delete_all
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
composite_primary_keys-0.7.0 test/delete_test.rb
composite_primary_keys-0.7.1 test/delete_test.rb
composite_primary_keys-0.6.2 test/delete_test.rb
composite_primary_keys-0.6.3 test/delete_test.rb
composite_primary_keys-0.7.3 test/delete_test.rb
composite_primary_keys-0.7.5 test/delete_test.rb
composite_primary_keys-0.7.2 test/delete_test.rb
composite_primary_keys-0.7.4 test/delete_test.rb