diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-13 15:13:10 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-13 15:13:10 +0300 |
commit | 8ebd99a81f8fe458153de9815f73f9067d010293 (patch) | |
tree | 29390f8f6e89af290768a32e4bb6cf281c44105d /spec/services | |
parent | c283bdb7bc86aee27a7ed065fc9fb17e4c4ffee6 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services')
3 files changed, 13 insertions, 25 deletions
diff --git a/spec/services/container_registry/protection/create_rule_service_spec.rb b/spec/services/container_registry/protection/create_rule_service_spec.rb index 3c319caf25c..4559a8fb131 100644 --- a/spec/services/container_registry/protection/create_rule_service_spec.rb +++ b/spec/services/container_registry/protection/create_rule_service_spec.rb @@ -22,7 +22,7 @@ RSpec.describe ContainerRegistry::Protection::CreateRuleService, '#execute', fea container_registry_protection_rule: be_a(ContainerRegistry::Protection::Rule) .and(have_attributes( - container_path_pattern: params[:container_path_pattern], + repository_path_pattern: params[:repository_path_pattern], push_protected_up_to_access_level: params[:push_protected_up_to_access_level].to_s, delete_protected_up_to_access_level: params[:delete_protected_up_to_access_level].to_s )) @@ -36,7 +36,7 @@ RSpec.describe ContainerRegistry::Protection::CreateRuleService, '#execute', fea expect( ContainerRegistry::Protection::Rule.where( project: project, - container_path_pattern: params[:container_path_pattern], + repository_path_pattern: params[:repository_path_pattern], push_protected_up_to_access_level: params[:push_protected_up_to_access_level] ) ).to exist @@ -57,7 +57,7 @@ RSpec.describe ContainerRegistry::Protection::CreateRuleService, '#execute', fea expect( ContainerRegistry::Protection::Rule.where( project: project, - container_path_pattern: params[:container_path_pattern], + repository_path_pattern: params[:repository_path_pattern], push_protected_up_to_access_level: params[:push_protected_up_to_access_level] ) ).not_to exist @@ -67,12 +67,12 @@ RSpec.describe ContainerRegistry::Protection::CreateRuleService, '#execute', fea it_behaves_like 'a successful service response' context 'when fields are invalid' do - context 'when container_path_pattern is invalid' do - let(:params) { super().merge(container_path_pattern: '') } + context 'when repository_path_pattern is invalid' do + let(:params) { super().merge(repository_path_pattern: '') } it_behaves_like 'an erroneous service response' - it { is_expected.to have_attributes(message: match(/Container path pattern can't be blank/)) } + it { is_expected.to have_attributes(message: match(/Repository path pattern can't be blank/)) } end context 'when delete_protected_up_to_access_level is invalid' do @@ -100,8 +100,8 @@ RSpec.describe ContainerRegistry::Protection::CreateRuleService, '#execute', fea context 'when container registry name pattern is slightly different' do let(:params) do super().merge( - # The field `container_path_pattern` is unique; this is why we change the value in a minimum way - container_path_pattern: "#{existing_container_registry_protection_rule.container_path_pattern}-unique", + # The field `repository_path_pattern` is unique; this is why we change the value in a minimum way + repository_path_pattern: "#{existing_container_registry_protection_rule.repository_path_pattern}-unique", push_protected_up_to_access_level: existing_container_registry_protection_rule.push_protected_up_to_access_level ) @@ -110,17 +110,17 @@ RSpec.describe ContainerRegistry::Protection::CreateRuleService, '#execute', fea it_behaves_like 'a successful service response' end - context 'when field `container_path_pattern` is taken' do + context 'when field `repository_path_pattern` is taken' do let(:params) do super().merge( - container_path_pattern: existing_container_registry_protection_rule.container_path_pattern, + repository_path_pattern: existing_container_registry_protection_rule.repository_path_pattern, push_protected_up_to_access_level: :maintainer ) end it_behaves_like 'an erroneous service response' - it { is_expected.to have_attributes(errors: ['Container path pattern has already been taken']) } + it { is_expected.to have_attributes(errors: ['Repository path pattern has already been taken']) } it { expect { subject }.not_to change { existing_container_registry_protection_rule.updated_at } } end diff --git a/spec/services/container_registry/protection/delete_rule_service_spec.rb b/spec/services/container_registry/protection/delete_rule_service_spec.rb index bdc2ca727d2..acefe6a55d0 100644 --- a/spec/services/container_registry/protection/delete_rule_service_spec.rb +++ b/spec/services/container_registry/protection/delete_rule_service_spec.rb @@ -58,7 +58,7 @@ RSpec.describe ContainerRegistry::Protection::DeleteRuleService, '#execute', fea context 'with deleted container registry protection rule' do let!(:container_registry_protection_rule) do create(:container_registry_protection_rule, project: project, - container_path_pattern: 'protection_rule_deleted').destroy! + repository_path_pattern: 'protection_rule_deleted').destroy! end it_behaves_like 'a successful service response' diff --git a/spec/services/import/github_service_spec.rb b/spec/services/import/github_service_spec.rb index 39832ee4b13..fc649b61426 100644 --- a/spec/services/import/github_service_spec.rb +++ b/spec/services/import/github_service_spec.rb @@ -5,12 +5,7 @@ require 'spec_helper' RSpec.describe Import::GithubService, feature_category: :importers do let_it_be(:user) { create(:user) } let_it_be(:token) { 'complex-token' } - let_it_be(:access_params) do - { - github_access_token: 'github-complex-token', - additional_access_tokens: %w[foo bar] - } - end + let_it_be(:access_params) { { github_access_token: 'github-complex-token' } } let(:settings) { instance_double(Gitlab::GithubImport::Settings) } let(:user_namespace_path) { user.namespace_path } @@ -37,7 +32,6 @@ RSpec.describe Import::GithubService, feature_category: :importers do .to receive(:write) .with( optional_stages: optional_stages, - additional_access_tokens: access_params[:additional_access_tokens], timeout_strategy: timeout_strategy ) end @@ -98,7 +92,6 @@ RSpec.describe Import::GithubService, feature_category: :importers do expect(settings) .to have_received(:write) .with(optional_stages: nil, - additional_access_tokens: access_params[:additional_access_tokens], timeout_strategy: timeout_strategy ) expect_snowplow_event( @@ -124,7 +117,6 @@ RSpec.describe Import::GithubService, feature_category: :importers do .to have_received(:write) .with( optional_stages: nil, - additional_access_tokens: access_params[:additional_access_tokens], timeout_strategy: timeout_strategy ) expect_snowplow_event( @@ -157,7 +149,6 @@ RSpec.describe Import::GithubService, feature_category: :importers do .to have_received(:write) .with( optional_stages: nil, - additional_access_tokens: access_params[:additional_access_tokens], timeout_strategy: timeout_strategy ) expect_snowplow_event( @@ -194,7 +185,6 @@ RSpec.describe Import::GithubService, feature_category: :importers do .to have_received(:write) .with( optional_stages: optional_stages, - additional_access_tokens: access_params[:additional_access_tokens], timeout_strategy: timeout_strategy ) end @@ -210,7 +200,6 @@ RSpec.describe Import::GithubService, feature_category: :importers do .to have_received(:write) .with( optional_stages: optional_stages, - additional_access_tokens: access_params[:additional_access_tokens], timeout_strategy: timeout_strategy ) end @@ -224,7 +213,6 @@ RSpec.describe Import::GithubService, feature_category: :importers do .to have_received(:write) .with( optional_stages: optional_stages, - additional_access_tokens: %w[foo bar], timeout_strategy: timeout_strategy ) end |