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 deletes milestone", :js, feature_category: :team_planning do
|
2018-11-20 20:47:30 +05:30
|
|
|
let(:user) { create(:user) }
|
|
|
|
let(:group) { create(:group) }
|
|
|
|
let(:project) { create(:project, namespace: group) }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
context "when milestone belongs to project" do
|
2019-12-21 20:55:43 +05:30
|
|
|
let!(:milestone) { create(:milestone, resource_parent: project, title: "project milestone") }
|
2018-11-20 20:47:30 +05:30
|
|
|
|
|
|
|
it "deletes milestone" do
|
|
|
|
project.add_developer(user)
|
|
|
|
visit(project_milestones_path(project))
|
|
|
|
click_link(milestone.title)
|
2023-06-20 00:43:36 +05:30
|
|
|
click_button("Milestone actions")
|
2018-11-20 20:47:30 +05:30
|
|
|
click_button("Delete")
|
|
|
|
click_button("Delete milestone")
|
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
expect(page).to have_content("Use milestones to track issues and merge requests over a fixed period of time")
|
2018-11-20 20:47:30 +05:30
|
|
|
|
|
|
|
visit(activity_project_path(project))
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
expect(page).to have_content("#{user.name} #{user.to_reference} destroyed milestone")
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
context "when milestone belongs to group" do
|
2019-12-21 20:55:43 +05:30
|
|
|
let!(:milestone_to_be_deleted) { create(:milestone, resource_parent: group, title: "group milestone 1") }
|
|
|
|
let!(:milestone) { create(:milestone, resource_parent: group, title: "group milestone 2") }
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
it "deletes milestone" do
|
|
|
|
group.add_developer(user)
|
|
|
|
visit(group_milestones_path(group))
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
click_link(milestone_to_be_deleted.title)
|
2023-06-20 00:43:36 +05:30
|
|
|
click_button("Milestone actions")
|
2018-11-20 20:47:30 +05:30
|
|
|
click_button("Delete")
|
|
|
|
click_button("Delete milestone")
|
2018-10-15 14:42:47 +05:30
|
|
|
|
2018-11-20 20:47:30 +05:30
|
|
|
expect(page).to have_content(milestone.title)
|
|
|
|
expect(page).not_to have_content(milestone_to_be_deleted)
|
|
|
|
end
|
2018-10-15 14:42:47 +05:30
|
|
|
end
|
|
|
|
end
|