Skip to content

Commit

Permalink
Simplify cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emmenko committed Jul 14, 2015
1 parent 9b16d7d commit 77b1146
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 2 additions & 4 deletions src/spec/integration/categories.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,8 @@ describe 'Integration Categories', ->

afterEach (done) ->
debug 'About to delete all categories'
@client.categories.all().fetch()
.then (payload) =>
debug "Deleting #{payload.body.total} categories (maxParallel: 1)"
@client.setMaxParallel(1)
@client.categories.process (payload) =>
debug "Deleting #{payload.body.total} categories"
Promise.map payload.body.results, (category) =>
@client.categories.byId(category.id).delete(category.version)
.then (results) ->
Expand Down
10 changes: 4 additions & 6 deletions src/spec/integration/customers.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ describe 'Integration Customers', ->
beforeEach (done) ->
@client = new SphereClient config: Config
debug 'About to delete all customers'
@client.customers.all().fetch()
.then (payload) =>
debug "Deleting #{payload.body.total} customers (maxParallel: 1)"
@client.setMaxParallel(1)
Promise.all _.map payload.body.results, (category) =>
@client.customers.byId(category.id).delete(category.version)
@client.customers.process (payload) =>
debug "Deleting #{payload.body.total} customers"
Promise.map payload.body.results, (customer) =>
@client.customers.byId(customer.id).delete(customer.version)
.then (results) ->
debug "Deleted #{results.length} customers"
done()
Expand Down

0 comments on commit 77b1146

Please sign in to comment.