         return Promise.reject "Archive was not generated"
     .then ->
       console.log "Archive was generated successfully"
-      extractArchive(file, {dir: '/tmp'})
+      extractArchive(file, {dir: tempDir.name})
     .then ->
 
       try
-        fs.statSync '/tmp/products'
-        exportedFolder = '/tmp/products/'
+        exportedFolder = path.join tempDir.name, 'products'
+        fs.statSync exportedFolder # test if file was created
         files = fs.readdirSync(exportedFolder)
         expect(files.length).toBe 1
-        csvFile = exportedFolder + files[0]
-        fs.statSync csvFile
+        csvFile = path.join exportedFolder, files[0]
+        fs.statSync csvFile # test if file was created
       catch e
-        return Promise.reject 'Archive was not successfully parsed'
+        return Promise.reject 'Archive was not successfully created or parsed'
 
       fs.readFileAsync csvFile, {encoding: 'utf8'}
     .then (content) =>

{Export} = require '../../lib/main'
extract = require 'extract-zip'
extractArchive = Promise.promisify(extract)

describe 'Export integration tests', ->


_ = require 'underscore'
path = require 'path'
_.mixin require('underscore-mixins')
Promise = require 'bluebird'
fs = Promise.promisifyAll require('fs')
