Sha256: 9b0d88eeeae97751682fea96b6344300ef2424b1f23dbe34af96c03d6972f734

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

require File.expand_path('../abstract_unit', __FILE__)

class TestDeleteWithoutPK < ActiveSupport::TestCase

  # can't load fixtures because other test dependencies
  setup do
    EmployeesGroup.create(employee_id: 1, group_id: 1)
    EmployeesGroup.create(employee_id: 1, group_id: 2)
    EmployeesGroup.create(employee_id: 2, group_id: 1)
    EmployeesGroup.create(employee_id: 2, group_id: 1)
  end

  def test_destroy_without_primary_key
    employees_group = EmployeesGroup.first
    assert_raise(ActiveRecord::CompositeKeyError) do
      employees_group.destroy
    end
    assert_equal 4, EmployeesGroup.count
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
composite_primary_keys-5.0.14 test/test_delete_without_pk.rb