blob: 115701c5c02e0421031672a6f998f60aeaebfe74 (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# frozen_string_literal: true
module QA
RSpec.describe 'Plan' do
describe 'Milestones' do
include Support::Dates
let(:start_date) { current_date_yyyy_mm_dd }
let(:due_date) { next_month_yyyy_mm_dd }
let(:group) do
Resource::Group.fabricate_via_api! do |group|
group.name = 'group-to-test-milestones'
end
end
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'project-to-test-milestones'
end
end
let(:issue) do
Resource::Issue.fabricate_via_api! do |issue|
issue.project = project
end
end
before do
Flow::Login.sign_in
end
shared_examples 'milestone assigned to existing issue' do
it 'is assigned to an existing issue' do
issue.visit!
Page::Project::Issue::Show.perform do |existing_issue|
existing_issue.assign_milestone(milestone)
expect(existing_issue).to have_milestone(milestone.title)
end
end
end
shared_examples 'milestone assigned to new issue' do
it 'is assigned to a new issue' do
Resource::Issue.fabricate_via_browser_ui! do |new_issue|
new_issue.project = project
new_issue.milestone = milestone
end
Page::Project::Issue::Show.perform do |issue|
expect(issue).to have_milestone(milestone.title)
end
end
end
context 'Group milestone' do
let(:milestone) do
Resource::GroupMilestone.fabricate_via_api! do |milestone|
milestone.group = group
milestone.start_date = start_date
milestone.due_date = due_date
end
end
it_behaves_like 'milestone assigned to existing issue'
it_behaves_like 'milestone assigned to new issue'
end
context 'Project milestone' do
let(:milestone) do
Resource::ProjectMilestone.fabricate_via_api! do |milestone|
milestone.project = project
milestone.start_date = start_date
milestone.due_date = due_date
end
end
it_behaves_like 'milestone assigned to existing issue'
it_behaves_like 'milestone assigned to new issue'
end
end
end
end
|