diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 18:08:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 18:08:47 +0000 |
commit | 3832718d895bf8268f3e3aac85948e2792769345 (patch) | |
tree | 4a322399af568b6203e732ae2e2f3efc39b23a67 /spec/controllers | |
parent | 180cd023a11c0eb413ad0de124d9758ea25672bd (diff) | |
download | gitlab-ce-3832718d895bf8268f3e3aac85948e2792769345.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
3 files changed, 39 insertions, 5 deletions
diff --git a/spec/controllers/admin/applications_controller_spec.rb b/spec/controllers/admin/applications_controller_spec.rb index 2f3c7da484b..63b28b2d993 100644 --- a/spec/controllers/admin/applications_controller_spec.rb +++ b/spec/controllers/admin/applications_controller_spec.rb @@ -40,7 +40,7 @@ describe Admin::ApplicationsController do describe 'POST #create' do it 'creates the application' do - create_params = attributes_for(:application, trusted: true) + create_params = attributes_for(:application, trusted: true, confidential: false) expect do post :create, params: { doorkeeper_application: create_params } @@ -60,16 +60,34 @@ describe Admin::ApplicationsController do expect(response).to render_template :new expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes) end + + context 'when the params are for a confidential application' do + it 'creates a confidential application' do + create_params = attributes_for(:application, confidential: true) + + expect do + post :create, params: { doorkeeper_application: create_params } + end.to change { Doorkeeper::Application.count }.by(1) + + application = Doorkeeper::Application.last + + expect(response).to redirect_to(admin_application_path(application)) + expect(application).to have_attributes(create_params.except(:uid, :owner_type)) + end + end end describe 'PATCH #update' do it 'updates the application' do - patch :update, params: { id: application.id, doorkeeper_application: { redirect_uri: 'http://example.com/', trusted: true } } + doorkeeper_params = { redirect_uri: 'http://example.com/', trusted: true, confidential: false } + + patch :update, params: { id: application.id, doorkeeper_application: doorkeeper_params } application.reload expect(response).to redirect_to(admin_application_path(application)) - expect(application).to have_attributes(redirect_uri: 'http://example.com/', trusted: true) + expect(application) + .to have_attributes(redirect_uri: 'http://example.com/', trusted: true, confidential: false) end it 'renders the application form on errors' do @@ -78,5 +96,16 @@ describe Admin::ApplicationsController do expect(response).to render_template :edit expect(assigns[:scopes]).to be_kind_of(Doorkeeper::OAuth::Scopes) end + + context 'when updating the application to be confidential' do + it 'successfully sets the application to confidential' do + doorkeeper_params = { confidential: true } + + patch :update, params: { id: application.id, doorkeeper_application: doorkeeper_params } + + expect(response).to redirect_to(admin_application_path(application)) + expect(application).to be_confidential + end + end end end diff --git a/spec/controllers/groups/registry/repositories_controller_spec.rb b/spec/controllers/groups/registry/repositories_controller_spec.rb index 4129891914d..9463483b7b0 100644 --- a/spec/controllers/groups/registry/repositories_controller_spec.rb +++ b/spec/controllers/groups/registry/repositories_controller_spec.rb @@ -17,6 +17,8 @@ describe Groups::Registry::RepositoriesController do context 'GET #index' do context 'when container registry is enabled' do it 'show index page' do + expect(Gitlab::Tracking).not_to receive(:event) + get :index, params: { group_id: group } @@ -54,7 +56,8 @@ describe Groups::Registry::RepositoriesController do expect(Gitlab::Tracking).to receive(:event).with(anything, 'list_repositories', {}) get :index, params: { - group_id: group + group_id: group, + format: :json } end end diff --git a/spec/controllers/projects/registry/repositories_controller_spec.rb b/spec/controllers/projects/registry/repositories_controller_spec.rb index 192e4ce2e73..4e832a478af 100644 --- a/spec/controllers/projects/registry/repositories_controller_spec.rb +++ b/spec/controllers/projects/registry/repositories_controller_spec.rb @@ -35,6 +35,8 @@ describe Projects::Registry::RepositoriesController do end it 'successfully renders container repositories' do + expect(Gitlab::Tracking).not_to receive(:event) + go_to_index expect(response).to have_gitlab_http_status(:ok) @@ -43,7 +45,7 @@ describe Projects::Registry::RepositoriesController do it 'tracks the event' do expect(Gitlab::Tracking).to receive(:event).with(anything, 'list_repositories', {}) - go_to_index + go_to_index(format: :json) end it 'creates a root container repository' do |