Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 06:08:01 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 06:08:01 +0300
commit796b00a98a82fcbe082c9343fd4efcccc77478dc (patch)
tree257bcb124f57cb91a8dff75e69649e8a2f91c51d /spec/models
parent93dcf45d441bc884b167f4338380c8c888e9b86f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/chat_name_spec.rb6
-rw-r--r--spec/models/project_spec.rb14
2 files changed, 20 insertions, 0 deletions
diff --git a/spec/models/chat_name_spec.rb b/spec/models/chat_name_spec.rb
index 863c28a86fb..02594b98665 100644
--- a/spec/models/chat_name_spec.rb
+++ b/spec/models/chat_name_spec.rb
@@ -17,6 +17,12 @@ describe ChatName do
it { is_expected.to validate_uniqueness_of(:user_id).scoped_to(:service_id) }
it { is_expected.to validate_uniqueness_of(:chat_id).scoped_to(:service_id, :team_id) }
+ it 'is removed when the project is deleted' do
+ expect { subject.reload.service.project.delete }.to change { ChatName.count }.by(-1)
+
+ expect(ChatName.where(id: subject.id)).not_to exist
+ end
+
describe '#update_last_used_at', :clean_gitlab_redis_shared_state do
it 'updates the last_used_at timestamp' do
expect(subject.last_used_at).to be_nil
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 508098bfc39..1b12550ebac 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -5729,6 +5729,20 @@ describe Project do
end
end
+ describe 'with services and chat names' do
+ subject { create(:project) }
+
+ let(:service) { create(:service, project: subject) }
+
+ before do
+ create_list(:chat_name, 5, service: service)
+ end
+
+ it 'removes chat names on removal' do
+ expect { subject.destroy }.to change { ChatName.count }.by(-5)
+ end
+ end
+
describe 'with_issues_or_mrs_available_for_user' do
before do
Project.delete_all