Skip to content

Commit 7637a15

Browse files
committed
Extend feature tests
1 parent 3661f27 commit 7637a15

1 file changed

Lines changed: 87 additions & 2 deletions

File tree

features/add-project-through-cli.feature

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Feature: Add a project to the manifest via the CLI
3131
dst: ext/MyLib
3232
"""
3333

34-
Scenario: Duplicate project name is rejected
34+
Scenario: Duplicate project name is auto-renamed in non-interactive mode
3535
Given the manifest 'dfetch.yaml'
3636
"""
3737
manifest:
@@ -41,7 +41,12 @@ Feature: Add a project to the manifest via the CLI
4141
url: some-remote-server/MyLib.git
4242
"""
4343
When I add "some-remote-server/MyLib.git" with force
44-
Then the command fails with "already exists in manifest"
44+
Then the manifest 'dfetch.yaml' contains entry
45+
"""
46+
- name: MyLib-1
47+
url: some-remote-server/MyLib.git
48+
branch: master
49+
"""
4550

4651
Scenario: Destination is guessed from common prefix of existing projects
4752
Given the manifest 'dfetch.yaml'
@@ -114,6 +119,86 @@ Feature: Add a project to the manifest via the CLI
114119
tag: v1
115120
"""
116121

122+
Scenario: Interactive add with src subpath
123+
Given the manifest 'dfetch.yaml'
124+
"""
125+
manifest:
126+
version: '0.0'
127+
projects:
128+
- name: existing
129+
url: some-remote-server/existing.git
130+
"""
131+
When I interactively add "some-remote-server/MyLib.git" with inputs
132+
| prompt_contains | answer |
133+
| Project name | my-lib |
134+
| Destination path | my-lib |
135+
| Version | master |
136+
| Source path | docs/api |
137+
| Ignore paths | |
138+
| Add project to manifest? | y |
139+
| Run update | n |
140+
Then the manifest 'dfetch.yaml' contains entry
141+
"""
142+
- name: my-lib
143+
url: some-remote-server/MyLib.git
144+
branch: master
145+
src: docs/api
146+
"""
147+
148+
Scenario: Interactive add with ignore list
149+
Given the manifest 'dfetch.yaml'
150+
"""
151+
manifest:
152+
version: '0.0'
153+
projects:
154+
- name: existing
155+
url: some-remote-server/existing.git
156+
"""
157+
When I interactively add "some-remote-server/MyLib.git" with inputs
158+
| prompt_contains | answer |
159+
| Project name | my-lib |
160+
| Destination path | my-lib |
161+
| Version | master |
162+
| Source path | |
163+
| Ignore paths | docs, tests |
164+
| Add project to manifest? | y |
165+
| Run update | n |
166+
Then the manifest 'dfetch.yaml' contains entry
167+
"""
168+
- name: my-lib
169+
url: some-remote-server/MyLib.git
170+
branch: master
171+
ignore:
172+
- docs
173+
- tests
174+
"""
175+
176+
Scenario: Interactive add triggers immediate fetch when update is accepted
177+
Given the manifest 'dfetch.yaml'
178+
"""
179+
manifest:
180+
version: '0.0'
181+
projects:
182+
- name: existing
183+
url: some-remote-server/existing.git
184+
"""
185+
When I interactively add "some-remote-server/MyLib.git" with inputs
186+
| prompt_contains | answer |
187+
| Project name | MyLib |
188+
| Destination path | MyLib |
189+
| Version | master |
190+
| Source path | |
191+
| Ignore paths | |
192+
| Add project to manifest? | y |
193+
| Run update | y |
194+
Then the manifest 'dfetch.yaml' contains entry
195+
"""
196+
- name: MyLib
197+
url: some-remote-server/MyLib.git
198+
branch: master
199+
"""
200+
And 'MyLib/README.md' exists
201+
117202
Scenario: Interactive add with abort does not modify manifest
118203
Given the manifest 'dfetch.yaml'
119204
"""

0 commit comments

Comments
 (0)