From cc5a984075609aa522981ddc9a12d3c4e1d152f7 Mon Sep 17 00:00:00 2001 From: Watson Date: Thu, 23 Nov 2023 15:31:21 +0900 Subject: [PATCH] Add test --- test/test_future.rb | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/test_future.rb b/test/test_future.rb index 7ebf074..d9e292c 100644 --- a/test/test_future.rb +++ b/test/test_future.rb @@ -76,4 +76,25 @@ def test_on_failure assert_raises(Ilios::Cassandra::ExecutionError) { future.on_failure {} } end + + def test_complex_case + statement = Ilios::Cassandra.session.prepare('SELECT * FROM ilios.test;') + future = Ilios::Cassandra.session.execute_async(statement) + + count = 0 + + future.on_failure do + count += 1 + end + + sleep(2) + + future.on_success do + count += 1 + end + + future.await + + assert_equal(1, count) + end end