spec/models/authz/role_grant_spec.rb in authz-0.0.2 vs spec/models/authz/role_grant_spec.rb in authz-0.0.3
- old
+ new
@@ -1,6 +1,17 @@
module Authz
RSpec.describe RoleGrant, type: :model do
+
+ describe 'DB indexes' do
+ it 'should have a composite unique index on rolable_type_rolable_id_role_id' do
+ expect(
+ ActiveRecord::Migration.index_exists?(described_class.table_name,
+ [:rolable_type, :rolable_id, :authz_role_id],
+ unique: true)
+ ).to be true
+ end
+ end
+
describe 'Associations' do
it { should belong_to(:role) }
it { should belong_to(:rolable) }
end