summaryrefslogtreecommitdiff
path: root/spec/controllers/dashboard
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 12:09:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 12:09:13 +0000
commit211a8c3361ccf4eb92f36edbdcf15c98fcdcc8b7 (patch)
tree0ad37172721a39b0d57240bb1b4e70f200a0d93e /spec/controllers/dashboard
parent456a7247f9e88fc2518b69a1a00e905c6db6d775 (diff)
downloadgitlab-ce-211a8c3361ccf4eb92f36edbdcf15c98fcdcc8b7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/dashboard')
-rw-r--r--spec/controllers/dashboard/projects_controller_spec.rb33
1 files changed, 25 insertions, 8 deletions
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