mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-08 00:23:01 +08:00
27 lines
779 B
Ruby
27 lines
779 B
Ruby
require 'rails_helper'
|
|
|
|
RSpec.describe UserRole, type: :model do
|
|
it 'should be of class UserRole' do
|
|
expect(subject.class).to eq UserRole
|
|
end
|
|
|
|
describe 'Database table' do
|
|
it { should have_db_column :name }
|
|
it { should have_db_column :permissions }
|
|
it { should have_db_column :created_by_id }
|
|
it { should have_db_column :last_modified_by_id }
|
|
it { should have_db_column :created_at }
|
|
it { should have_db_column :updated_at }
|
|
end
|
|
|
|
describe 'Relations' do
|
|
it { should have_many :user_assignments }
|
|
it { should belong_to :created_by }
|
|
it { should belong_to :last_modified_by }
|
|
end
|
|
|
|
describe 'Should be a valid object' do
|
|
it { should validate_presence_of :name }
|
|
it { should validate_presence_of :permissions }
|
|
end
|
|
end
|