2016-12-20 09:48:04 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
describe 'Milestone show', feature: true do
|
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:project) { create(:empty_project) }
|
|
|
|
let(:milestone) { create(:milestone, project: project) }
|
|
|
|
let(:labels) { create_list(:label, 2, project: project) }
|
2017-05-04 08:11:15 -04:00
|
|
|
let(:issue_params) { { project: project, assignees: [user], author: user, milestone: milestone, labels: labels } }
|
2016-12-20 09:48:04 -05:00
|
|
|
|
|
|
|
before do
|
|
|
|
project.add_user(user, :developer)
|
2017-06-21 19:44:10 -04:00
|
|
|
sign_in(user)
|
2016-12-20 09:48:04 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def visit_milestone
|
2017-07-06 12:20:50 -04:00
|
|
|
visit project_milestone_path(project, milestone)
|
2016-12-20 09:48:04 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'avoids N+1 database queries' do
|
|
|
|
create(:labeled_issue, issue_params)
|
|
|
|
control_count = ActiveRecord::QueryRecorder.new { visit_milestone }.count
|
|
|
|
create_list(:labeled_issue, 10, issue_params)
|
|
|
|
|
|
|
|
expect { visit_milestone }.not_to exceed_query_limit(control_count)
|
|
|
|
end
|
|
|
|
end
|