-
Notifications
You must be signed in to change notification settings - Fork 4
/
init_adr_repo.feature
89 lines (81 loc) · 3.42 KB
/
init_adr_repo.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
Feature: Initialise a git ADR repository
Since 'git adr' makes calls to 'pyadr', some features will be already fully
tested in the bdd tests for 'pyadr'.
Background:
Given a new working directory
Scenario: Fail when an ADR repo directory already exists
Given a directory named "docs/adr"
When I run "git adr init"
Then it should fail
Scenario: Fail when a git repo has not been initialised
When I run "git adr init"
Then it should fail with:
"""
No Git repository found in directory '{__WORKDIR__}/'. Please initialise a Git repository before running command.
"""
Scenario: Create and commit initial ADR files on empty git repo
Given an empty git repo with "main" as initial branch
When I run "git adr init"
Then it should pass with
"""
Files committed to branch 'main' with commit message
"""
And the command output should contain
"""
Git repo empty. Will commit files to 'main'.
"""
And there should be 1 commit in "main"
And the head commit message should be
"""
docs(adr): initialise adr repository
"""
And 3 files should be committed in the last commit
And the file "docs/adr/template.md" should be committed in the last commit
And the file "docs/adr/0000-record-architecture-decisions.md" should be committed in the last commit
And the file "docs/adr/0001-use-markdown-architectural-decision-records.md" should be committed in the last commit
Scenario: Initialise for ADR only repo
Given an empty git repo with "main" as initial branch
When I run "git adr init --adr-only-repo"
Then it should pass
And the head commit message should be
"""
feat(adr): initialise adr repository
"""
Scenario: Create and commit initial ADR files on a non-empty git repo
Given a starting git repo with "main" as initial branch
When I run "git adr init"
Then it should pass with
"""
Files committed to branch 'adr-init-repo' with commit message
"""
And the branch "adr-init-repo" should exist
And the head should be at branch "adr-init-repo"
And there should be 1 commit between head and the branch "main"
Scenario: Fail when index dirty
Given a starting git repo with "main" as initial branch
And a file named "foo" with
"""
bar
"""
And I add the file "foo" to the git index
When I run "git adr init"
Then it should fail with
"""
Verifying Git index is empty...
... files staged in Git index. Clean before running command.
"""
Scenario: Fail when init branch exists
Given an empty git repo with "main" as initial branch
And a file named "foo" with
"""
bar
"""
And I add the file "foo" to the git index
And I commit the git index with message "foo bar"
And I create the branch "adr-init-repo"
When I run "git adr init"
Then it should fail with
"""
Verifying branch 'adr-init-repo' does not exist...
... branch 'adr-init-repo' already exists. Clean before running command.
"""