diff options
Diffstat (limited to 'spec/controllers')
4 files changed, 56 insertions, 6 deletions
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index c1cfe9f20d2..bdac7369780 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -896,7 +896,7 @@ describe ApplicationController do end end - context '#set_current_context' do + describe '#set_current_context' do controller(described_class) do def index Labkit::Context.with_context do |context| diff --git a/spec/controllers/groups/registry/repositories_controller_spec.rb b/spec/controllers/groups/registry/repositories_controller_spec.rb index 9463483b7b0..eb702d65325 100644 --- a/spec/controllers/groups/registry/repositories_controller_spec.rb +++ b/spec/controllers/groups/registry/repositories_controller_spec.rb @@ -14,7 +14,7 @@ describe Groups::Registry::RepositoriesController do sign_in(user) end - context 'GET #index' do + shared_examples 'renders a list of repositories' do context 'when container registry is enabled' do it 'show index page' do expect(Gitlab::Tracking).not_to receive(:event) @@ -33,6 +33,7 @@ describe Groups::Registry::RepositoriesController do } expect(response).to match_response_schema('registry/repositories') + expect(response).to include_pagination_headers end it 'returns a list of projects for json format' do @@ -89,5 +90,29 @@ describe Groups::Registry::RepositoriesController do expect(response).to have_gitlab_http_status(:not_found) end end + + context 'with :vue_container_registry_explorer feature flag disabled' do + before do + stub_feature_flags(vue_container_registry_explorer: false) + end + + it 'has the correct response schema' do + get :index, params: { + group_id: group, + format: :json + } + + expect(response).to match_response_schema('registry/repositories') + expect(response).not_to include_pagination_headers + end + end + end + + context 'GET #index' do + it_behaves_like 'renders a list of repositories' + end + + context 'GET #show' do + it_behaves_like 'renders a list of repositories' end end diff --git a/spec/controllers/projects/milestones_controller_spec.rb b/spec/controllers/projects/milestones_controller_spec.rb index 3efdeda6171..6b698c6da66 100644 --- a/spec/controllers/projects/milestones_controller_spec.rb +++ b/spec/controllers/projects/milestones_controller_spec.rb @@ -245,7 +245,7 @@ describe Projects::MilestonesController do end end - context '#participants' do + describe '#participants' do render_views context "when guest user" do diff --git a/spec/controllers/projects/registry/repositories_controller_spec.rb b/spec/controllers/projects/registry/repositories_controller_spec.rb index 4e832a478af..5b9c0211b39 100644 --- a/spec/controllers/projects/registry/repositories_controller_spec.rb +++ b/spec/controllers/projects/registry/repositories_controller_spec.rb @@ -16,7 +16,7 @@ describe Projects::Registry::RepositoriesController do project.add_developer(user) end - describe 'GET index' do + shared_examples 'renders a list of repositories' do context 'when root container repository exists' do before do create(:container_repository, :root, project: project) @@ -58,6 +58,7 @@ describe Projects::Registry::RepositoriesController do expect(response).to have_gitlab_http_status(:ok) expect(response).to match_response_schema('registry/repositories') + expect(response).to include_pagination_headers end end @@ -84,9 +85,33 @@ describe Projects::Registry::RepositoriesController do end end end + + context 'with :vue_container_registry_explorer feature flag disabled' do + before do + stub_feature_flags(vue_container_registry_explorer: false) + stub_container_registry_tags(repository: project.full_path, + tags: %w[rc1 latest]) + end + + it 'json has a list of projects' do + go_to_index(format: :json) + + expect(response).to have_gitlab_http_status(:ok) + expect(response).to match_response_schema('registry/repositories') + expect(response).not_to include_pagination_headers + end + end + end + + describe 'GET #index' do + it_behaves_like 'renders a list of repositories' + end + + describe 'GET #show' do + it_behaves_like 'renders a list of repositories' end - describe 'DELETE destroy' do + describe 'DELETE #destroy' do context 'when root container repository exists' do let!(:repository) do create(:container_repository, :root, project: project) @@ -115,7 +140,7 @@ describe Projects::Registry::RepositoriesController do end context 'when user does not have access to registry' do - describe 'GET index' do + describe 'GET #index' do it 'responds with 404' do go_to_index |