Skip to content

Commit

Permalink
Merge pull request #309 from HuaweiTech/hw-issue-28
Browse files Browse the repository at this point in the history
Fix in clearing space fields of config data on cf space-delete
  • Loading branch information
Simon Leung committed Dec 18, 2014
2 parents bfcded2 + 5d5a8b4 commit 364a89e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cf/commands/space/delete_space.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (cmd *DeleteSpace) Run(c *cli.Context) {

cmd.ui.Ok()

if cmd.config.SpaceFields().Name == spaceName {
if cmd.config.SpaceFields().Guid == space.Guid {
cmd.config.SetSpaceFields(models.SpaceFields{})
cmd.ui.Say(T("TIP: No space targeted, use '{{.CfTargetCommand}}' to target a space",
map[string]interface{}{"CfTargetCommand": cf.Name() + " target -s"}))
Expand Down
7 changes: 7 additions & 0 deletions cf/commands/space/delete_space_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,11 @@ var _ = Describe("delete-space command", func() {

Expect(config.HasSpace()).To(Equal(false))
})

It("clears the space from the config, when deleting the space currently targeted even if space name is case insensitive", func() {
config.SetSpaceFields(space.SpaceFields)
runCommand("-f", "Space-To-Delete")

Expect(config.HasSpace()).To(Equal(false))
})
})

0 comments on commit 364a89e

Please sign in to comment.