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

27 lines
807 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
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)
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