blob: 141e626c6f3474de4e1ed2c326a5e6c206de1b69 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe "User deletes milestone", :js, feature_category: :team_planning do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) }
before do
sign_in(user)
end
context "when milestone belongs to project" do
let!(:milestone) { create(:milestone, resource_parent: project, title: "project milestone") }
it "deletes milestone" do
project.add_developer(user)
visit(project_milestones_path(project))
click_link(milestone.title)
click_button("Delete")
click_button("Delete milestone")
expect(page).to have_content("Use milestones to track issues and merge requests over a fixed period of time")
visit(activity_project_path(project))
expect(page).to have_content("#{user.name} #{user.to_reference} destroyed milestone")
end
end
context "when milestone belongs to group" do
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") }
it "deletes milestone" do
group.add_developer(user)
visit(group_milestones_path(group))
click_link(milestone_to_be_deleted.title)
click_button("Delete")
click_button("Delete milestone")
expect(page).to have_content(milestone.title)
expect(page).not_to have_content(milestone_to_be_deleted)
end
end
end
|