 			@urlStream.resume = sinon.stub()
 			@fs.createWriteStream = sinon.stub().returns(@fileStream = new EventEmitter)
 			@fs.unlink = (file, callback) -> callback()
-			@UrlFetcher.pipeUrlToFile(@url, @path, @callback)
-
-		it "should request the URL", ->
-			@request.get
-				.calledWith(sinon.match {"url": @url})
-				.should.equal true
-
+			done()
 
 		describe "successfully", ->
-			beforeEach ->
+			beforeEach (done)->
+				@UrlFetcher.pipeUrlToFile @url, @path, =>
+					@callback()
+					done()
 				@res = statusCode: 200
 				@urlStream.emit "response", @res
 				@urlStream.emit "end"
 				@fileStream.emit "finish"
+
+
+			it "should request the URL", ->
+				@request.get
+					.calledWith(sinon.match {"url": @url})
+					.should.equal true
 
 			it "should open the file for writing", ->
 				@fs.createWriteStream

		@defaults.calledWith(jar: false)
			.should.equal true
		
	describe "_pipeUrlToFile", ->
		beforeEach ->
			@path = "/path/to/file/on/disk"
			@request.get = sinon.stub().returns(@urlStream = new EventEmitter)
			@urlStream.pipe = sinon.stub()

					.should.equal true

		describe "with error", ->
			beforeEach (done)->
				@UrlFetcher.pipeUrlToFile @url, @path, (err)=>
					@callback(err)
					done()
				@urlStream.emit "error", @error = new Error("something went wrong")

			it "should call the callback with the error", ->
