debian-mirror-gitlab/spec/features/milestones/show_spec.rb

27 lines
788 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'rails_helper'
2017-09-10 17:25:29 +05:30
describe 'Milestone show' do
2017-08-17 22:00:37 +05:30
let(:user) { create(:user) }
2017-09-10 17:25:29 +05:30
let(:project) { create(:project) }
2017-08-17 22:00:37 +05:30
let(:milestone) { create(:milestone, project: project) }
let(:labels) { create_list(:label, 2, project: project) }
let(:issue_params) { { project: project, assignees: [user], author: user, milestone: milestone, labels: labels } }
before do
2018-03-17 18:26:18 +05:30
project.add_user(user, :developer)
2017-09-10 17:25:29 +05:30
sign_in(user)
2017-08-17 22:00:37 +05:30
end
def visit_milestone
2017-09-10 17:25:29 +05:30
visit project_milestone_path(project, milestone)
2017-08-17 22:00:37 +05:30
end
it 'avoids N+1 database queries' do
create(:labeled_issue, issue_params)
2018-03-17 18:26:18 +05:30
control = ActiveRecord::QueryRecorder.new { visit_milestone }
2017-08-17 22:00:37 +05:30
create_list(:labeled_issue, 10, issue_params)
2018-03-17 18:26:18 +05:30
expect { visit_milestone }.not_to exceed_query_limit(control)
2017-08-17 22:00:37 +05:30
end
end