Sha256: 1de10516a8a7a759058b6554826d1eda6ce9ea9964b645466b9a967abf6bbacc
Contents?: true
Size: 877 Bytes
Versions: 5
Compression:
Stored size: 877 Bytes
Contents
require File.expand_path('../abstract_unit', __FILE__) class EmployeesGroup < ActiveRecord::Base end class TestValidations < ActiveSupport::TestCase fixtures :employees def test_delete_for_model_without_primary_key EmployeesGroup.create(employee_id: 1, group_id: 100) EmployeesGroup.create(employee_id: 2, group_id: 102) EmployeesGroup.create(employee_id: 3, group_id: 103) assert_equal(EmployeesGroup.all.size, 3) exception = assert_raises(NoMethodError) { EmployeesGroup.where(employee_id: 1).first.destroy } assert(/undefined method `to_sym' for nil:NilClass/ =~ exception.message) assert(EmployeesGroup.all.size == 3) end # This test fails, requires fixin arel #def test_delete_all_with_joins # ReferenceCode.joins(:reference_type).where(:reference_type_id => 1).delete_all #end end
Version data entries
5 entries across 5 versions & 1 rubygems