diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 15:09:13 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-07 15:09:13 +0300 |
commit | 211a8c3361ccf4eb92f36edbdcf15c98fcdcc8b7 (patch) | |
tree | 0ad37172721a39b0d57240bb1b4e70f200a0d93e /spec/controllers | |
parent | 456a7247f9e88fc2518b69a1a00e905c6db6d775 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
4 files changed, 34 insertions, 35 deletions
diff --git a/spec/controllers/admin/services_controller_spec.rb b/spec/controllers/admin/services_controller_spec.rb index 44233776865..6f59a5ac016 100644 --- a/spec/controllers/admin/services_controller_spec.rb +++ b/spec/controllers/admin/services_controller_spec.rb @@ -15,11 +15,11 @@ describe Admin::ServicesController do Service.available_services_names.each do |service_name| context "#{service_name}" do let!(:service) do - service_template = "#{service_name}_service".camelize.constantize - service_template.where(template: true).first_or_create + service_instance = "#{service_name}_service".camelize.constantize + service_instance.where(instance: true).first_or_create end - it 'successfully displays the template' do + it 'successfully displays the service' do get :edit, params: { id: service.id } expect(response).to have_gitlab_http_status(:ok) @@ -34,7 +34,7 @@ describe Admin::ServicesController do RedmineService.create( project: project, active: false, - template: true, + instance: true, properties: { project_url: 'http://abc', issues_url: 'http://abc', @@ -44,7 +44,7 @@ describe Admin::ServicesController do end it 'calls the propagation worker when service is active' do - expect(PropagateServiceTemplateWorker).to receive(:perform_async).with(service.id) + expect(PropagateInstanceLevelServiceWorker).to receive(:perform_async).with(service.id) put :update, params: { id: service.id, service: { active: true } } @@ -52,7 +52,7 @@ describe Admin::ServicesController do end it 'does not call the propagation worker when service is not active' do - expect(PropagateServiceTemplateWorker).not_to receive(:perform_async) + expect(PropagateInstanceLevelServiceWorker).not_to receive(:perform_async) put :update, params: { id: service.id, service: { properties: {} } } diff --git a/spec/controllers/concerns/lfs_request_spec.rb b/spec/controllers/concerns/lfs_request_spec.rb index 79257e9a7f6..67c81156ca6 100644 --- a/spec/controllers/concerns/lfs_request_spec.rb +++ b/spec/controllers/concerns/lfs_request_spec.rb @@ -10,8 +10,6 @@ describe LfsRequest do include LfsRequest def show - storage_project - head :ok end @@ -38,22 +36,6 @@ describe LfsRequest do stub_lfs_setting(enabled: true) end - describe '#storage_project' do - it 'assigns the project as storage project' do - get :show, params: { id: project.id } - - expect(assigns(:storage_project)).to eq(project) - end - - it 'assigns the source of a forked project' do - forked_project = fork_project(project) - - get :show, params: { id: forked_project.id } - - expect(assigns(:storage_project)).to eq(project) - end - end - context 'user is authenticated without access to lfs' do before do allow(controller).to receive(:authenticate_user) diff --git a/spec/controllers/dashboard/projects_controller_spec.rb b/spec/controllers/dashboard/projects_controller_spec.rb index d013093c376..a13b56deb23 100644 --- a/spec/controllers/dashboard/projects_controller_spec.rb +++ b/spec/controllers/dashboard/projects_controller_spec.rb @@ -11,7 +11,14 @@ describe Dashboard::ProjectsController do end context 'user logged in' do - let(:user) { create(:user) } + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project) } + let_it_be(:project2) { create(:project) } + + before_all do + project.add_developer(user) + project2.add_developer(user) + end before do sign_in(user) @@ -28,12 +35,7 @@ describe Dashboard::ProjectsController do end it 'orders the projects by last activity by default' do - project = create(:project) - project.add_developer(user) project.update!(last_repository_updated_at: 3.days.ago, last_activity_at: 3.days.ago) - - project2 = create(:project) - project2.add_developer(user) project2.update!(last_repository_updated_at: 10.days.ago, last_activity_at: 10.days.ago) get :index @@ -42,12 +44,27 @@ describe Dashboard::ProjectsController do end context 'project sorting' do - let(:project) { create(:project) } - it_behaves_like 'set sort order from user preference' do let(:sorting_param) { 'created_asc' } end end + + context 'with search and sort parameters' do + render_views + + shared_examples 'search and sort parameters' do |sort| + it 'returns a single project with no ambiguous column errors' do + get :index, params: { name: project2.name, sort: sort } + + expect(response).to have_gitlab_http_status(:ok) + expect(assigns(:projects)).to eq([project2]) + end + end + + %w[latest_activity_desc latest_activity_asc stars_desc stars_asc created_desc].each do |sort| + it_behaves_like 'search and sort parameters', sort + end + end end end diff --git a/spec/controllers/projects/services_controller_spec.rb b/spec/controllers/projects/services_controller_spec.rb index 0c074714bf3..b76d350ebbc 100644 --- a/spec/controllers/projects/services_controller_spec.rb +++ b/spec/controllers/projects/services_controller_spec.rb @@ -154,12 +154,12 @@ describe Projects::ServicesController do end end - context 'when activating Jira service from a template' do + context 'when activating Jira service from instance level service' do let(:service) do - create(:jira_service, project: project, template: true) + create(:jira_service, project: project, instance: true) end - it 'activate Jira service from template' do + it 'activate Jira service from instance level service' do expect(flash[:notice]).to eq 'Jira activated.' end end |