diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-30 03:09:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-03-30 03:09:26 +0300 |
commit | 7c930ae00e3dd714574ebb72bab77303bd1c77c9 (patch) | |
tree | 8adf88c9ebea2861ce59b5cb34b6b13ab69666a6 /spec | |
parent | 12c766c77475bb96d18846546d5af909c648830d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
5 files changed, 44 insertions, 44 deletions
diff --git a/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb b/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb index 50e799908c6..dbf74bd9333 100644 --- a/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb +++ b/spec/lib/gitlab/background_migration/backfill_snippet_repositories_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migration, schema: 2020_04_20_094444 do +RSpec.describe Gitlab::BackgroundMigration::BackfillSnippetRepositories, :migration, schema: 2021_03_13_045845 do let(:gitlab_shell) { Gitlab::Shell.new } let(:users) { table(:users) } let(:snippets) { table(:snippets) } diff --git a/spec/lib/gitlab/ci/config/entry/cache_spec.rb b/spec/lib/gitlab/ci/config/entry/cache_spec.rb index 064990667d5..cec1c97085b 100644 --- a/spec/lib/gitlab/ci/config/entry/cache_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/cache_spec.rb @@ -13,6 +13,14 @@ RSpec.describe Gitlab::Ci::Config::Entry::Cache do end describe '#valid?' do + context 'with an empty hash as cache' do + let(:config) { {} } + + it 'is valid' do + expect(entry).to be_valid + end + end + context 'when configuration is valid with a single cache' do let(:config) { { key: 'key', paths: ["logs/"], untracked: true } } diff --git a/spec/presenters/project_hook_presenter_spec.rb b/spec/presenters/project_hook_presenter_spec.rb index 061ec38ae34..2e4bd17bbe1 100644 --- a/spec/presenters/project_hook_presenter_spec.rb +++ b/spec/presenters/project_hook_presenter_spec.rb @@ -11,7 +11,7 @@ RSpec.describe ProjectHookPresenter do subject { web_hook.present.logs_details_path(web_hook_log) } let(:expected_path) do - "/#{project.namespace.path}/#{project.name}/hooks/#{web_hook.id}/hook_logs/#{web_hook_log.id}" + "/#{project.namespace.path}/#{project.name}/-/hooks/#{web_hook.id}/hook_logs/#{web_hook_log.id}" end it { is_expected.to eq(expected_path) } @@ -21,7 +21,7 @@ RSpec.describe ProjectHookPresenter do subject { web_hook.present.logs_details_path(web_hook_log) } let(:expected_path) do - "/#{project.namespace.path}/#{project.name}/hooks/#{web_hook.id}/hook_logs/#{web_hook_log.id}" + "/#{project.namespace.path}/#{project.name}/-/hooks/#{web_hook.id}/hook_logs/#{web_hook_log.id}" end it { is_expected.to eq(expected_path) } diff --git a/spec/presenters/projects/settings/deploy_keys_presenter_spec.rb b/spec/presenters/projects/settings/deploy_keys_presenter_spec.rb index 1dc714e1320..0d340c5e713 100644 --- a/spec/presenters/projects/settings/deploy_keys_presenter_spec.rb +++ b/spec/presenters/projects/settings/deploy_keys_presenter_spec.rb @@ -27,43 +27,31 @@ RSpec.describe Projects::Settings::DeployKeysPresenter do let_it_be(:unrelated_project) { create(:project, :private) } let_it_be(:unrelated_deploy_key) { create(:deploy_key, projects: [unrelated_project]) } - shared_examples_for 'correct behavior' do - context 'with enabled keys' do - it 'returns correct deploy keys' do - expect(presenter.enabled_keys).to eq([deploy_key]) - expect(presenter.enabled_keys_size).to eq(1) - end - end - - context 'with available keys' do - it 'returns correct deploy keys' do - expect(presenter.available_keys).to eq([other_deploy_key, public_deploy_key]) - end + context 'with enabled keys' do + it 'returns correct deploy keys' do + expect(presenter.enabled_keys).to eq([deploy_key]) + expect(presenter.enabled_keys_size).to eq(1) end + end - context 'with available project keys' do - it 'returns correct deploy keys' do - expect(presenter.available_project_keys).to eq([other_deploy_key]) - expect(presenter.available_project_keys_size).to eq(1) - end + context 'with available keys' do + it 'returns correct deploy keys' do + expect(presenter.available_keys).to eq([other_deploy_key, public_deploy_key]) end + end - context 'with available public keys' do - it 'returns correct deploy keys' do - expect(presenter.available_public_keys).to eq([public_deploy_key]) - expect(presenter.available_public_keys_size).to eq(1) - end + context 'with available project keys' do + it 'returns correct deploy keys' do + expect(presenter.available_project_keys).to eq([other_deploy_key]) + expect(presenter.available_project_keys_size).to eq(1) end end - it_behaves_like 'correct behavior' - - context 'when optimize_deploy_keys_presenter feature flag is disabled' do - before do - stub_feature_flags(optimize_deploy_keys_presenter: false) + context 'with available public keys' do + it 'returns correct deploy keys' do + expect(presenter.available_public_keys).to eq([public_deploy_key]) + expect(presenter.available_public_keys_size).to eq(1) end - - it_behaves_like 'correct behavior' end end diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index f7ed8d7d5dc..c1afc35ee89 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -335,33 +335,37 @@ RSpec.describe 'project routing' do end end - # test_project_hook POST /:project_id/hooks/:id/test(.:format) hooks#test - # project_hooks GET /:project_id/hooks(.:format) hooks#index - # POST /:project_id/hooks(.:format) hooks#create - # edit_project_hook GET /:project_id/hooks/:id/edit(.:format) hooks#edit - # project_hook PUT /:project_id/hooks/:id(.:format) hooks#update - # DELETE /:project_id/hooks/:id(.:format) hooks#destroy + # test_project_hook POST /:project_id/-/hooks/:id/test(.:format) hooks#test + # project_hooks GET /:project_id/-/hooks(.:format) hooks#index + # POST /:project_id/-/hooks(.:format) hooks#create + # edit_project_hook GET /:project_id/-/hooks/:id/edit(.:format) hooks#edit + # project_hook PUT /:project_id/-/hooks/:id(.:format) hooks#update + # DELETE /:project_id/-/hooks/:id(.:format) hooks#destroy describe Projects::HooksController, 'routing' do it 'to #test' do - expect(post('/gitlab/gitlabhq/hooks/1/test')).to route_to('projects/hooks#test', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') + expect(post('/gitlab/gitlabhq/-/hooks/1/test')).to route_to('projects/hooks#test', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1') end it_behaves_like 'resource routing' do let(:actions) { %i[index create destroy edit update] } - let(:base_path) { '/gitlab/gitlabhq/hooks' } + let(:base_path) { '/gitlab/gitlabhq/-/hooks' } end + + it_behaves_like 'redirecting a legacy path', '/gitlab/gitlabhq/hooks', '/gitlab/gitlabhq/-/hooks' end - # retry_namespace_project_hook_hook_log POST /:project_id/hooks/:hook_id/hook_logs/:id/retry(.:format) projects/hook_logs#retry - # namespace_project_hook_hook_log GET /:project_id/hooks/:hook_id/hook_logs/:id(.:format) projects/hook_logs#show + # retry_namespace_project_hook_hook_log POST /:project_id/-/hooks/:hook_id/hook_logs/:id/retry(.:format) projects/hook_logs#retry + # namespace_project_hook_hook_log GET /:project_id/-/hooks/:hook_id/hook_logs/:id(.:format) projects/hook_logs#show describe Projects::HookLogsController, 'routing' do it 'to #retry' do - expect(post('/gitlab/gitlabhq/hooks/1/hook_logs/1/retry')).to route_to('projects/hook_logs#retry', namespace_id: 'gitlab', project_id: 'gitlabhq', hook_id: '1', id: '1') + expect(post('/gitlab/gitlabhq/-/hooks/1/hook_logs/1/retry')).to route_to('projects/hook_logs#retry', namespace_id: 'gitlab', project_id: 'gitlabhq', hook_id: '1', id: '1') end it 'to #show' do - expect(get('/gitlab/gitlabhq/hooks/1/hook_logs/1')).to route_to('projects/hook_logs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', hook_id: '1', id: '1') + expect(get('/gitlab/gitlabhq/-/hooks/1/hook_logs/1')).to route_to('projects/hook_logs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', hook_id: '1', id: '1') end + + it_behaves_like 'redirecting a legacy path', '/gitlab/gitlabhq/hooks/hook_logs/1', '/gitlab/gitlabhq/-/hooks/hook_logs/1' end # project_commit GET /:project_id/commit/:id(.:format) commit#show {id: /\h{7,40}/, project_id: /[^\/]+/} |