diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-05 00:16:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-05 00:16:06 +0300 |
commit | 44bb0760bd78154bb74b8d923535c679caef5e05 (patch) | |
tree | a94cbdbab09988112e779abcd9bc7a1a26e7b212 /spec | |
parent | 17a58755f31fcca5f6f42a4f7de1bbf1934dd038 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
4 files changed, 20 insertions, 12 deletions
diff --git a/spec/experiments/application_experiment_spec.rb b/spec/experiments/application_experiment_spec.rb index 7c2b5382c42..8e06c06a5d1 100644 --- a/spec/experiments/application_experiment_spec.rb +++ b/spec/experiments/application_experiment_spec.rb @@ -359,8 +359,8 @@ RSpec.describe ApplicationExperiment, :experiment do end it "returns an assigned name" do - application_experiment.try(:variant1) {} - application_experiment.try(:variant2) {} + application_experiment.variant(:variant1) {} + application_experiment.variant(:variant2) {} expect(application_experiment.variant.name).to eq('variant2') end @@ -395,8 +395,8 @@ RSpec.describe ApplicationExperiment, :experiment do cache.clear(key: application_experiment.name) - application_experiment.use { } # setup the control - application_experiment.try { } # setup the candidate + application_experiment.control { } + application_experiment.candidate { } end it "caches the variant determined by the variant resolver" do diff --git a/spec/features/gitlab_experiments_spec.rb b/spec/features/gitlab_experiments_spec.rb index ca772680ff6..af14b6e2e95 100644 --- a/spec/features/gitlab_experiments_spec.rb +++ b/spec/features/gitlab_experiments_spec.rb @@ -21,8 +21,8 @@ RSpec.describe "Gitlab::Experiment", :js do allow_next_instance_of(Admin::AbuseReportsController) do |instance| allow(instance).to receive(:index).and_wrap_original do |original| instance.experiment(:null_hypothesis, user: instance.current_user) do |e| - e.use { original.call } - e.try { original.call } + e.control { original.call } + e.candidate { original.call } end end end diff --git a/spec/services/projects/container_repository/delete_tags_service_spec.rb b/spec/services/projects/container_repository/delete_tags_service_spec.rb index 94037d6de1e..246ca301cfa 100644 --- a/spec/services/projects/container_repository/delete_tags_service_spec.rb +++ b/spec/services/projects/container_repository/delete_tags_service_spec.rb @@ -14,7 +14,7 @@ RSpec.describe Projects::ContainerRepository::DeleteTagsService do ] end - RSpec.shared_examples 'logging a success response' do + shared_examples 'logging a success response' do it 'logs an info message' do expect(service).to receive(:log_info).with( service_class: 'Projects::ContainerRepository::DeleteTagsService', @@ -28,7 +28,7 @@ RSpec.describe Projects::ContainerRepository::DeleteTagsService do end end - RSpec.shared_examples 'logging an error response' do |message: 'could not delete tags', extra_log: {}| + shared_examples 'logging an error response' do |message: 'could not delete tags', extra_log: {}| it 'logs an error message' do log_data = { service_class: 'Projects::ContainerRepository::DeleteTagsService', @@ -45,7 +45,7 @@ RSpec.describe Projects::ContainerRepository::DeleteTagsService do end end - RSpec.shared_examples 'calling the correct delete tags service' do |expected_service_class| + shared_examples 'calling the correct delete tags service' do |expected_service_class| let(:service_response) { { status: :success, deleted: tags } } let(:excluded_service_class) { available_service_classes.excluding(expected_service_class).first } @@ -69,7 +69,7 @@ RSpec.describe Projects::ContainerRepository::DeleteTagsService do end end - RSpec.shared_examples 'handling invalid params' do + shared_examples 'handling invalid params' do context 'with invalid params' do before do expect(::Projects::ContainerRepository::Gitlab::DeleteTagsService).not_to receive(:new) @@ -91,7 +91,7 @@ RSpec.describe Projects::ContainerRepository::DeleteTagsService do end end - RSpec.shared_examples 'supporting fast delete' do + shared_examples 'supporting fast delete' do context 'when the registry supports fast delete' do before do allow(repository.client).to receive(:supports_tag_delete?).and_return(true) @@ -155,6 +155,14 @@ RSpec.describe Projects::ContainerRepository::DeleteTagsService do it_behaves_like 'handling invalid params' end + + context 'when the repository is importing' do + before do + repository.update_columns(migration_state: 'importing', migration_import_started_at: Time.zone.now) + end + + it { is_expected.to include(status: :error, message: 'repository importing') } + end end context 'without user' do diff --git a/spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb b/spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb index 21be989d697..e26b8cd8b37 100644 --- a/spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb +++ b/spec/support/shared_contexts/services/projects/container_repository/delete_tags_service_shared_context.rb @@ -3,7 +3,7 @@ RSpec.shared_context 'container repository delete tags service shared context' do let_it_be(:user) { create(:user) } let_it_be(:project, reload: true) { create(:project, :private) } - let_it_be(:repository) { create(:container_repository, :root, project: project) } + let_it_be_with_reload(:repository) { create(:container_repository, :root, project: project) } let(:params) { { tags: tags } } |