diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 13:34:06 +0300 |
commit | 859a6fb938bb9ee2a317c46dfa4fcc1af49608f0 (patch) | |
tree | d7f2700abe6b4ffcb2dcfc80631b2d87d0609239 /spec/services/snippets | |
parent | 446d496a6d000c73a304be52587cd9bbc7493136 (diff) |
Add latest changes from gitlab-org/gitlab@13-9-stable-eev13.9.0-rc42
Diffstat (limited to 'spec/services/snippets')
-rw-r--r-- | spec/services/snippets/create_service_spec.rb | 5 | ||||
-rw-r--r-- | spec/services/snippets/update_repository_storage_service_spec.rb | 13 | ||||
-rw-r--r-- | spec/services/snippets/update_service_spec.rb | 13 |
3 files changed, 15 insertions, 16 deletions
diff --git a/spec/services/snippets/create_service_spec.rb b/spec/services/snippets/create_service_spec.rb index 96807fd629f..32a09e1afc8 100644 --- a/spec/services/snippets/create_service_spec.rb +++ b/spec/services/snippets/create_service_spec.rb @@ -6,6 +6,7 @@ RSpec.describe Snippets::CreateService do describe '#execute' do let_it_be(:user) { create(:user) } let_it_be(:admin) { create(:user, :admin) } + let(:action) { :create } let(:opts) { base_opts.merge(extra_opts) } let(:base_opts) do { @@ -309,7 +310,7 @@ RSpec.describe Snippets::CreateService do it_behaves_like 'a service that creates a snippet' it_behaves_like 'public visibility level restrictions apply' - it_behaves_like 'snippets spam check is performed' + it_behaves_like 'checking spam' it_behaves_like 'snippet create data is tracked' it_behaves_like 'an error service response when save fails' it_behaves_like 'creates repository and files' @@ -337,7 +338,7 @@ RSpec.describe Snippets::CreateService do it_behaves_like 'a service that creates a snippet' it_behaves_like 'public visibility level restrictions apply' - it_behaves_like 'snippets spam check is performed' + it_behaves_like 'checking spam' it_behaves_like 'snippet create data is tracked' it_behaves_like 'an error service response when save fails' it_behaves_like 'creates repository and files' diff --git a/spec/services/snippets/update_repository_storage_service_spec.rb b/spec/services/snippets/update_repository_storage_service_spec.rb index b2bcd620d76..6ba09a9dca9 100644 --- a/spec/services/snippets/update_repository_storage_service_spec.rb +++ b/spec/services/snippets/update_repository_storage_service_spec.rb @@ -54,13 +54,18 @@ RSpec.describe Snippets::UpdateRepositoryStorageService do end context 'when the filesystems are the same' do - let(:destination) { snippet.repository_storage } + before do + expect(Gitlab::GitalyClient).to receive(:filesystem_id).twice.and_return(SecureRandom.uuid) + end - it 'bails out and does nothing' do + it 'updates the database without trying to move the repostory', :aggregate_failures do result = subject.execute + snippet.reload - expect(result).to be_error - expect(result.message).to match(/SameFilesystemError/) + expect(result).to be_success + expect(snippet).not_to be_repository_read_only + expect(snippet.repository_storage).to eq(destination) + expect(snippet.snippet_repository.shard_name).to eq(destination) end end diff --git a/spec/services/snippets/update_service_spec.rb b/spec/services/snippets/update_service_spec.rb index a2341dc71b2..e737c00ae67 100644 --- a/spec/services/snippets/update_service_spec.rb +++ b/spec/services/snippets/update_service_spec.rb @@ -6,6 +6,7 @@ RSpec.describe Snippets::UpdateService do describe '#execute', :aggregate_failures do let_it_be(:user) { create(:user) } let_it_be(:admin) { create :user, admin: true } + let(:action) { :update } let(:visibility_level) { Gitlab::VisibilityLevel::PRIVATE } let(:base_opts) do { @@ -738,11 +739,7 @@ RSpec.describe Snippets::UpdateService do it_behaves_like 'only file_name is present' it_behaves_like 'only content is present' it_behaves_like 'invalid params error response' - it_behaves_like 'snippets spam check is performed' do - before do - subject - end - end + it_behaves_like 'checking spam' context 'when snippet does not have a repository' do let!(:snippet) { create(:project_snippet, author: user, project: project) } @@ -766,11 +763,7 @@ RSpec.describe Snippets::UpdateService do it_behaves_like 'only file_name is present' it_behaves_like 'only content is present' it_behaves_like 'invalid params error response' - it_behaves_like 'snippets spam check is performed' do - before do - subject - end - end + it_behaves_like 'checking spam' context 'when snippet does not have a repository' do let!(:snippet) { create(:personal_snippet, author: user, project: project) } |