2019-07-26 18:40:36 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-26 22:59:00 +08:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-11-09 17:06:53 +08:00
|
|
|
RSpec.describe Views::Datatables::DatatablesTeam, type: :model do
|
2017-10-26 22:59:00 +08:00
|
|
|
describe 'Database table' do
|
|
|
|
it { should have_db_column :id }
|
|
|
|
it { should have_db_column :name }
|
|
|
|
it { should have_db_column :members }
|
|
|
|
it { should have_db_column :role }
|
|
|
|
it { should have_db_column :user_team_id }
|
|
|
|
it { should have_db_column :user_id }
|
2017-11-03 17:11:23 +08:00
|
|
|
it { should have_db_column :can_be_left }
|
2017-10-26 22:59:00 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'is readonly' do
|
|
|
|
let(:user) { create :user }
|
|
|
|
it do
|
2019-07-26 18:40:36 +08:00
|
|
|
expect do
|
2017-11-09 17:06:53 +08:00
|
|
|
Views::Datatables::DatatablesTeam.create!(user_id: user.id)
|
2019-07-26 18:40:36 +08:00
|
|
|
end.to raise_error(ActiveRecord::ReadOnlyRecord,
|
|
|
|
'Views::Datatables::DatatablesTeam is marked as readonly')
|
2017-10-26 22:59:00 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|