@@ -207,8 +207,8 @@ var _ = Describe("DeployCommand", func() {
207207 command .FileUrlReadTimeout = time .Second
208208 })
209209
210- // unknown flag - error
211- Context ("with argument that is not a directory or MTA" , func () {
210+ // with argument that is not a directory or MTA and a valid and unknown flag (unknown flag - error)
211+ Context ("with argument that is not a directory or MTA and a valid and unknown flag " , func () {
212212 It ("should print incorrect usage, call cf help, and exit with a non-zero status" , func () {
213213 output , status := oc .CaptureOutputAndStatus (func () int {
214214 return command .Execute ([]string {"x" , "-l" }).ToInt ()
@@ -218,6 +218,7 @@ var _ = Describe("DeployCommand", func() {
218218 })
219219 })
220220
221+ // with argument that is a directory or MTA and with unknown flag (unknown flag - error)
221222 Context ("with argument that is a directory or MTA and with unknown flag" , func () {
222223 It ("should print incorrect usage, call cf help, and exit with a non-zero status" , func () {
223224 output , status := oc .CaptureOutputAndStatus (func () int {
@@ -228,6 +229,17 @@ var _ = Describe("DeployCommand", func() {
228229 })
229230 })
230231
232+ // with argument that is a directory or MTA and with unknown flags - some even duplicated (unknown flag - error)
233+ Context ("with argument that is a directory or MTA and with unknown flags - some even duplicated" , func () {
234+ It ("should print incorrect usage (and print the duplicating flags only once), call cf help, and exit with a non-zero status" , func () {
235+ output , status := oc .CaptureOutputAndStatus (func () int {
236+ return command .Execute ([]string {mtaArchivePath , "-nonValidFlag" , "-u" , "-nonValidFlag" , "-nonValidFlag" , "--flagInvalid" }).ToInt ()
237+ })
238+ ex .ExpectFailure (status , output , "Incorrect usage. Unknown or wrong flags: -nonValidFlag, --flagInvalid" )
239+ Expect (cliConnection .CliCommandArgsForCall (0 )).To (Equal ([]string {"help" , name }))
240+ })
241+ })
242+
231243 Context ("with a correct URL argument" , func () {
232244 It ("should upload the MTAR from the correct URL and initiate a deploy" , func () {
233245 command .FileUrlReader = newMockFileReader (correctMtaUrl )
0 commit comments