 
 	describe "wordcount", ->
 		beforeEach ->
-			@CommandRunner.run = sinon.stub().callsArg(5)
-			@fs.readFileSync = sinon.stub().returns @stdout = "Encoding: ascii\nWords in text: 2"
+			@CommandRunner.run = sinon.stub().callsArg(6)
+			@fs.readFile = sinon.stub().callsArgWith(2, null, @stdout = "Encoding: ascii\nWords in text: 2")
 			@callback  = sinon.stub()
 
 			@project_id = "project-id-123"

					elements: 0
					mathInline: 0
					mathDisplay: 0
				})
				.should.equal true

		it "should run the texcount command", ->
			@directory = "#{@Settings.path.compilesDir}/#{@project_id}-#{@user_id}"
			@file_path = "$COMPILE_DIR/#{@file_name}"
			@command =[ "texcount", "-nocol", "-inc", @file_path, "-out=" + @file_path + ".wc"]
			
			@CommandRunner.run
				.calledWith("#{@project_id}-#{@user_id}", @command, @directory, @image, @timeout, {})
				.should.equal true

		it "should call the callback with the parsed output", ->
