2023-03-07 03:17:45 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe TeamSharedObject, type: :model do
|
|
|
|
let(:user) { create :user }
|
|
|
|
let(:team) { create :team, created_by: user }
|
|
|
|
let(:another_team) { create :team, created_by: user }
|
|
|
|
let(:repository) { create :repository, team: team, created_by: user }
|
2023-10-12 22:16:43 +08:00
|
|
|
let(:team_shared_object) { create :team_shared_object, :read, team: another_team, shared_object: repository }
|
2023-03-07 03:17:45 +08:00
|
|
|
|
|
|
|
it 'is valid' do
|
|
|
|
expect(team_shared_object).to be_valid
|
|
|
|
end
|
|
|
|
|
2023-10-12 22:16:43 +08:00
|
|
|
it 'should be of class TeamSharedObject' do
|
|
|
|
expect(subject.class).to eq TeamSharedObject
|
|
|
|
end
|
2023-03-07 03:17:45 +08:00
|
|
|
|
2023-10-12 22:16:43 +08:00
|
|
|
describe 'Relations' do
|
|
|
|
it { should belong_to(:team) }
|
|
|
|
it { should belong_to(:shared_object) }
|
|
|
|
it { should belong_to(:shared_repository).optional }
|
2023-03-07 03:17:45 +08:00
|
|
|
end
|
|
|
|
end
|