Skip to content

Commit 7f642d3

Browse files
committed
run -> try; return code checks.
1 parent f91fecf commit 7f642d3

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

features/scaffold-package-github.feature

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Feature: Scaffold GitHub configuration for an existing package
99
"""
1010
Error: Directory does not exist.
1111
"""
12+
And the return code should be 1
1213

1314
Scenario: Fails when invalid package provided
1415
Given an empty directory
@@ -23,6 +24,7 @@ Feature: Scaffold GitHub configuration for an existing package
2324
"""
2425
Error: Invalid package directory. composer.json file must be present.
2526
"""
27+
And the return code should be 1
2628

2729
Scenario: Scaffold GitHub configuration based on defaults
2830
Given an empty directory

features/scaffold-package-readme.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Feature: Scaffold a README.md file for an existing package
99
"""
1010
Error: Directory does not exist.
1111
"""
12+
And the return code should be 1
1213

1314
Scenario: Fails when invalid package provided
1415
Given an empty directory
@@ -23,6 +24,7 @@ Feature: Scaffold a README.md file for an existing package
2324
"""
2425
Error: Invalid package directory. composer.json file must be present.
2526
"""
27+
And the return code should be 1
2628

2729
Scenario: Scaffold a README.md based on the defaults
2830
Given an empty directory
@@ -249,6 +251,7 @@ Feature: Scaffold a README.md file for an existing package
249251
"""
250252
Error: Missing one or more commands defined in composer.json -> extra -> commands.
251253
"""
254+
And the return code should be 1
252255

253256
Scenario: README for a bundled command
254257
Given an empty directory

features/scaffold-package-tests.feature

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Feature: Scaffold the test suite for an existing package
3333
"""
3434
Error: Directory does not exist.
3535
"""
36+
And the return code should be 1
3637

3738
Scenario: Fails when invalid package provided
3839
Given an empty directory
@@ -47,6 +48,7 @@ Feature: Scaffold the test suite for an existing package
4748
"""
4849
Error: Invalid package directory. composer.json file must be present.
4950
"""
51+
And the return code should be 1
5052

5153
Scenario: Scaffold package tests
5254
Given a invalid-command/command.php file:
@@ -100,6 +102,7 @@ Feature: Scaffold the test suite for an existing package
100102
"""
101103
Error: Invalid package directory. composer.json file must be present.
102104
"""
105+
And the return code should be 1
103106

104107
Scenario: Scaffolds .travis.yml configuration file by default
105108
When I run `wp scaffold package-tests community-command`
@@ -135,6 +138,11 @@ Feature: Scaffold the test suite for an existing package
135138
Then the community-command/features/load-wp-cli.feature file should not exist
136139
And the community-command/features/command.feature file should exist
137140

138-
When I run `wp scaffold package-tests community-command --force`
141+
When I try `wp scaffold package-tests community-command --force`
139142
Then the community-command/features/load-wp-cli.feature file should not exist
140143
And the community-command/features/command.feature file should exist
144+
And STDERR should contain:
145+
"""
146+
Warning: File already exists
147+
"""
148+
And the return code should be 0

features/scaffold-package.feature

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Feature: Scaffold WP-CLI commands
108108
"""
109109
Error: 'foo' is an invalid package name. Package scaffold expects '<author>/<package>'.
110110
"""
111+
And the return code should be 1
111112

112113
Scenario: Scaffold a WP-CLI command to a custom directory
113114
Given an empty directory
@@ -155,7 +156,7 @@ Feature: Scaffold WP-CLI commands
155156
Success: Created package files
156157
"""
157158

158-
When I run `wp scaffold package wp-cli/same-package --skip-tests --skip-github < session`
159+
When I try `wp scaffold package wp-cli/same-package --skip-tests --skip-github < session`
159160
And STDERR should contain:
160161
"""
161162
Warning: File already exists
@@ -164,6 +165,8 @@ Feature: Scaffold WP-CLI commands
164165
"""
165166
All package files were skipped
166167
"""
168+
And the return code should be 0
169+
167170
When I run `wp package uninstall wp-cli/same-package`
168171
Then STDOUT should contain:
169172
"""
@@ -226,12 +229,17 @@ Feature: Scaffold WP-CLI commands
226229
Scenario: Use tilde for HOME in package directory path
227230
Given an empty directory
228231
229-
When I run `wp scaffold package bar/foo --dir=~/foo --force --skip-tests --skip-readme`
232+
When I try `wp scaffold package bar/foo --dir=~/foo --force --skip-tests --skip-readme`
230233
Then STDOUT should contain:
231234
"""
232235
Success: Package installed.
233236
"""
237+
And STDERR should contain:
238+
"""
239+
Warning: File already exists
240+
"""
234241
And the /tmp/wp-cli-home/foo directory should exist
242+
And the return code should be 0
235243
236244
Scenario: Scaffold a package but skip installation and GitHub templates
237245
Given an empty directory

0 commit comments

Comments
 (0)