-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathaccept_or_reject_proposed_adr.feature
166 lines (137 loc) · 7.27 KB
/
accept_or_reject_proposed_adr.feature
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
Feature: Accept or reject proposed ADR - Git included
Background:
Given a new working directory
And an initialised git adr repo
Scenario: The proposed ADR should be already staged or committed
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md"
Then it should fail
And the command output should contain
"""
PyadrGitAdrNotStagedOrCommittedError
docs/adr/XXXX-my-adr-title.md
"""
And the command output should contain
"""
ADR 'docs/adr/XXXX-my-adr-title.md' should be staged or committed first.
"""
Scenario: Accepting should pass when the proposed ADR is staged (code shared with rejected => no need to duplicate test)
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md"
Then it should pass
Scenario: Accepting should pass when the proposed ADR is committed (code shared with rejected => no need to duplicate test)
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
And I commit the staged files with message "foo bar"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md"
Then it should pass
Scenario: An incremented ID number should be assigned to the accepted ADR (code shared with rejected => no need to duplicate test)
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md"
Then it should pass
And the file named "docs/adr/XXXX-my-adr-title.md" should not exist
And the file named "docs/adr/0002-my-adr-title.md" should exist
Scenario: The accepted ADR's filename should correspond to title of the ADR (code shared with rejected => no need to duplicate test)
Given a file named "docs/adr/XXXX-my-adr-title.md" with:
"""
# My Adr Updated Title
* Status: proposed
* Date: 2020-03-26
## Context and Problem Statement
Context and problem statement.
## Decision Outcome
Decision outcome.
"""
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md"
Then it should pass
And the file named "docs/adr/XXXX-my-adr-title.md" should not exist
And the file named "docs/adr/0002-my-adr-updated-title.md" should exist
Scenario: The renaming of the ADR file should be traced by git (code shared with rejected => no need to duplicate test)
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
And I commit the staged files with message "dummy message"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md"
Then it should pass
And the file "docs/adr/0002-my-adr-title.md" should be staged as renamed
Scenario: Accepted ADR's Status and Date should be updated
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md"
Then it should pass
And the file "docs/adr/0002-my-adr-title.md" should contain:
"""
# My Adr Title
* Status: accepted
* Date: {__TODAY_YYYY_MM_DD__}
## Context and Problem Statement
Context and problem statement.
## Decision Outcome
Decision outcome.
"""
Scenario: Rejected ADR's Status and Date should be updated
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr reject docs/adr/XXXX-my-adr-title.md"
Then it should pass
And the file named "docs/adr/XXXX-my-adr-title.md" should not exist
And the file named "docs/adr/0002-my-adr-title.md" should exist
And the file "docs/adr/0002-my-adr-title.md" should contain:
"""
# My Adr Title
* Status: rejected
* Date: {__TODAY_YYYY_MM_DD__}
## Context and Problem Statement
Context and problem statement.
## Decision Outcome
Decision outcome.
"""
# Scenario: All changes to accepted ADR should be staged (code shared with rejected => no need to duplicate test)
# Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
# And I stage the file "docs/adr/XXXX-my-adr-title.md"
# When I run "git adr accept docs/adr/XXXX-my-adr-title.md"
# Then it should pass
# And the file "docs/adr/0002-my-adr-title.md" should be staged
# And the file "docs/adr/0002-my-adr-title.md" should NOT be marked in the git working tree as modified
Scenario: Optionnaly, one should be able to re-generate the index upon acceptance
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md --toc"
Then it should pass with:
"""
Markdown table of content generated in 'docs/adr/index.md'
"""
And the file named "docs/adr/index.md" should exist
And the file "docs/adr/index.md" should be staged
Scenario: Optionnaly, one should be able to re-generate the index upon rejection
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr reject docs/adr/XXXX-my-adr-title.md --toc"
Then it should pass with:
"""
Markdown table of content generated in 'docs/adr/index.md'
"""
And the file named "docs/adr/index.md" should exist
And the file "docs/adr/index.md" should be staged
Scenario: Optionnaly, one should be able to commit the ADR upon acceptance
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr accept docs/adr/XXXX-my-adr-title.md --commit"
Then it should pass
And the file "docs/adr/0002-my-adr-title.md" should be committed in the last commit
And the head commit message should be
"""
docs(adr): [accepted] 0002-my-adr-title
"""
Scenario: Optionnaly, one should be able to commit the ADR upon rejection
Given a proposed adr file named "docs/adr/XXXX-my-adr-title.md"
And I stage the file "docs/adr/XXXX-my-adr-title.md"
When I run "git adr reject docs/adr/XXXX-my-adr-title.md --commit"
Then it should pass
And the file "docs/adr/0002-my-adr-title.md" should be committed in the last commit
And the head commit message should be
"""
docs(adr): [rejected] 0002-my-adr-title
"""