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

			@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


		describe "successfully", ->
			beforeEach ->
				@res = statusCode: 200
				@urlStream.emit "response", @res
				@urlStream.emit "end"
				@fileStream.emit "finish"

			it "should open the file for writing", ->
				@fs.createWriteStream

				@callback.called.should.equal true

		describe "with non success status code", ->
			beforeEach (done)->
				@UrlFetcher.pipeUrlToFile @url, @path, (err)=>
					@callback(err)
					done()	
				@res = statusCode: 404
				@urlStream.emit "response", @res
				@urlStream.emit "end"
