Diff

spec/util_async_spec.lua @ 8649:9246f64d6f1e

util.async: Add once() to create temporary runners
author Matthew Wild <mwild1@gmail.com>
date Thu, 22 Mar 2018 07:56:01 +0000
parent 8648:ca710a71d730
child 8650:2f133b6e8740
line wrap: on
line diff
--- a/spec/util_async_spec.lua	Thu Mar 22 07:46:23 2018 +0000
+++ b/spec/util_async_spec.lua	Thu Mar 22 07:56:01 2018 +0000
@@ -593,4 +593,14 @@
 			assert.spy(r.watchers.error).was_not.called();
 		end);
 	end);
+
+	describe("#once()", function ()
+		it("should work", function ()
+			local f = spy.new(function ()
+				assert.truthy(async.ready());
+			end);
+			async.once(f);
+			assert.spy(f).was.called();
+		end);
+	end);
 end);