summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-01-27 11:57:06 -0500
committerRobert Speicher <rspeicher@gmail.com>2017-01-27 11:57:06 -0500
commite629121870bdcb206233bdd0be8bad1f3dfea9fb (patch)
tree891bffd00c0c62456cbba8cc37cbb7303b0f2625 /spec/controllers
parent6ccc4eb42a05d4ce8b75773723305bd82305dfec (diff)
downloadgitlab-ce-e629121870bdcb206233bdd0be8bad1f3dfea9fb.tar.gz
Fix a transient failure in the `Explore::ProjectsController` specrs-issue-27350
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/explore/projects_controller_spec.rb25
1 files changed, 11 insertions, 14 deletions
diff --git a/spec/controllers/explore/projects_controller_spec.rb b/spec/controllers/explore/projects_controller_spec.rb
index 6128091f543..9dceeca168d 100644
--- a/spec/controllers/explore/projects_controller_spec.rb
+++ b/spec/controllers/explore/projects_controller_spec.rb
@@ -1,29 +1,26 @@
require 'spec_helper'
describe Explore::ProjectsController do
- let(:user) { create(:user) }
- let(:visibility) { :public }
-
describe 'GET #trending' do
- let!(:project_1) { create(:project, visibility, ci_id: 1) }
- let!(:project_2) { create(:project, visibility, ci_id: 2) }
-
- let!(:trending_project_1) { create(:trending_project, project: project_1) }
- let!(:trending_project_2) { create(:trending_project, project: project_2) }
+ context 'sorting by update date' do
+ let(:project1) { create(:empty_project, :public, updated_at: 3.days.ago) }
+ let(:project2) { create(:empty_project, :public, updated_at: 1.day.ago) }
- before do
- sign_in(user)
- end
+ before do
+ create(:trending_project, project: project1)
+ create(:trending_project, project: project2)
+ end
- context 'sorting by update date' do
it 'sorts by last updated' do
get :trending, sort: 'updated_desc'
- expect(assigns(:projects)).to eq [project_2, project_1]
+
+ expect(assigns(:projects)).to eq [project2, project1]
end
it 'sorts by oldest updated' do
get :trending, sort: 'updated_asc'
- expect(assigns(:projects)).to eq [project_1, project_2]
+
+ expect(assigns(:projects)).to eq [project1, project2]
end
end
end