Commit e6291218 authored by Robert Speicher's avatar Robert Speicher

Fix a transient failure in the `Explore::ProjectsController` spec

parent 6ccc4eb4
require 'spec_helper' require 'spec_helper'
describe Explore::ProjectsController do describe Explore::ProjectsController do
let(:user) { create(:user) }
let(:visibility) { :public }
describe 'GET #trending' do describe 'GET #trending' do
let!(:project_1) { create(:project, visibility, ci_id: 1) } context 'sorting by update date' do
let!(:project_2) { create(:project, visibility, ci_id: 2) } let(:project1) { create(:empty_project, :public, updated_at: 3.days.ago) }
let(:project2) { create(:empty_project, :public, updated_at: 1.day.ago) }
let!(:trending_project_1) { create(:trending_project, project: project_1) }
let!(:trending_project_2) { create(:trending_project, project: project_2) }
before do before do
sign_in(user) create(:trending_project, project: project1)
create(:trending_project, project: project2)
end end
context 'sorting by update date' do
it 'sorts by last updated' do it 'sorts by last updated' do
get :trending, sort: 'updated_desc' get :trending, sort: 'updated_desc'
expect(assigns(:projects)).to eq [project_2, project_1]
expect(assigns(:projects)).to eq [project2, project1]
end end
it 'sorts by oldest updated' do it 'sorts by oldest updated' do
get :trending, sort: 'updated_asc' get :trending, sort: 'updated_asc'
expect(assigns(:projects)).to eq [project_1, project_2]
expect(assigns(:projects)).to eq [project1, project2]
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment