debian-mirror-gitlab/spec/features/projects/milestones/milestone_spec.rb

90 lines
2.6 KiB
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
require 'spec_helper'
2018-11-08 19:23:39 +05:30
describe 'Project milestone' 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, name: 'test', namespace: user.namespace) }
2017-08-17 22:00:37 +05:30
let(:milestone) { create(:milestone, project: project) }
before do
2017-09-10 17:25:29 +05:30
sign_in(user)
2017-08-17 22:00:37 +05:30
end
context 'when project has enabled issues' do
before do
2017-09-10 17:25:29 +05:30
visit project_milestone_path(project, milestone)
2017-08-17 22:00:37 +05:30
end
it 'shows issues tab' do
within('#content-body') do
expect(page).to have_link 'Issues', href: '#tab-issues'
2018-11-08 19:23:39 +05:30
expect(page).to have_selector '.nav-links li a.active', count: 1
expect(find('.nav-links li a.active')).to have_content 'Issues'
2017-08-17 22:00:37 +05:30
end
end
it 'shows issues stats' do
expect(find('.milestone-sidebar')).to have_content 'Issues 0'
end
it 'shows link to browse and add issues' do
within('.milestone-sidebar') do
expect(page).to have_link 'New issue'
expect(page).to have_link 'Open: 0'
expect(page).to have_link 'Closed: 0'
end
end
end
context 'when project has disabled issues' do
before do
project.project_feature.update_attribute(:issues_access_level, ProjectFeature::DISABLED)
2017-09-10 17:25:29 +05:30
visit project_milestone_path(project, milestone)
2017-08-17 22:00:37 +05:30
end
it 'hides issues tab' do
within('#content-body') do
expect(page).not_to have_link 'Issues', href: '#tab-issues'
2018-11-08 19:23:39 +05:30
expect(page).to have_selector '.nav-links li a.active', count: 1
expect(find('.nav-links li a.active')).to have_content 'Merge Requests'
2017-08-17 22:00:37 +05:30
end
end
it 'hides issues stats' do
expect(find('.milestone-sidebar')).not_to have_content 'Issues 0'
end
it 'hides new issue button' do
within('.milestone-sidebar') do
expect(page).not_to have_link 'New issue'
end
end
it 'does not show an informative message' do
expect(page).not_to have_content('Assign some issues to this milestone.')
end
end
context 'when project has an issue' do
before do
create(:issue, project: project, milestone: milestone)
2017-09-10 17:25:29 +05:30
visit project_milestone_path(project, milestone)
2017-08-17 22:00:37 +05:30
end
describe 'the collapsed sidebar' do
before do
find('.milestone-sidebar .gutter-toggle').click
end
it 'shows the total MR and issue counts' do
find('.milestone-sidebar .block', match: :first)
aggregate_failures 'MR and issue blocks' do
expect(find('.milestone-sidebar .block.issues')).to have_content 1
expect(find('.milestone-sidebar .block.merge-requests')).to have_content 0
end
end
end
end
end