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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

103 lines
2.6 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2018-10-15 14:42:47 +05:30
2023-03-04 22:38:38 +05:30
RSpec.describe "User creates milestone", :js, feature_category: :team_planning do
2022-11-25 23:54:43 +05:30
let_it_be(:developer) { create(:user) }
let_it_be(:inherited_guest) { create(:user) }
let_it_be(:inherited_developer) { create(:user) }
let_it_be(:group) { create(:group, :public) }
shared_examples 'creates milestone' do
specify do
title = "v2.3"
fill_in("Title", with: title)
fill_in("Description", with: "# Description header")
click_button("Create milestone")
expect(page).to have_content(title)
.and have_content("Issues")
.and have_header_with_correct_id_and_link(1, "Description header", "description-header")
visit(activity_project_path(project))
expect(page).to have_content("#{user.name} #{user.to_reference} opened milestone")
end
end
shared_examples 'renders not found' do
specify do
expect(page).to have_title('Not Found')
expect(page).to have_content('Page Not Found')
end
end
before_all do
group.add_guest(inherited_guest)
group.add_developer(inherited_developer)
end
2018-10-15 14:42:47 +05:30
before do
sign_in(user)
visit(new_project_milestone_path(project))
end
2022-11-25 23:54:43 +05:30
context 'when project is public' do
let_it_be(:project) { create(:project, :public, group: group) }
context 'and issues and merge requests are private' do
before_all do
project.project_feature.update!(
issues_access_level: ProjectFeature::PRIVATE,
merge_requests_access_level: ProjectFeature::PRIVATE
)
end
context 'when user is an inherited member from the group' do
context 'and user is a guest' do
let(:user) { inherited_guest }
it_behaves_like 'renders not found'
end
context 'and user is a developer' do
let(:user) { inherited_developer }
it_behaves_like 'creates milestone'
end
end
end
end
context 'when project is private' do
let_it_be(:project) { create(:project, :private, group: group) }
context 'and user is a direct project member' do
before_all do
project.add_developer(developer)
end
context 'when user is a developer' do
let(:user) { developer }
it_behaves_like 'creates milestone'
end
end
2018-10-15 14:42:47 +05:30
2022-11-25 23:54:43 +05:30
context 'and user is an inherited member from the group' do
context 'when user is a guest' do
let(:user) { inherited_guest }
2018-10-15 14:42:47 +05:30
2022-11-25 23:54:43 +05:30
it_behaves_like 'renders not found'
end
2018-10-15 14:42:47 +05:30
2022-11-25 23:54:43 +05:30
context 'when user is a developer' do
let(:user) { inherited_developer }
2018-10-15 14:42:47 +05:30
2022-11-25 23:54:43 +05:30
it_behaves_like 'creates milestone'
end
end
2018-10-15 14:42:47 +05:30
end
end