From 48adceb7642603a69fa3848c7e3a236819fa24f4 Mon Sep 17 00:00:00 2001 From: "Brian J. Cardiff" Date: Wed, 19 Jul 2023 22:16:55 -0300 Subject: [PATCH] Add Fiber.yield to dummy driver to mimic real drivers IO --- spec/dummy_driver.cr | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/dummy_driver.cr b/spec/dummy_driver.cr index 85f947f..9fe64dc 100644 --- a/spec/dummy_driver.cr +++ b/spec/dummy_driver.cr @@ -19,6 +19,7 @@ class DummyDriver < DB::Driver class DummyConnection < DB::Connection def initialize(options : DB::Connection::Options) super(options) + Fiber.yield @connected = true @@connections ||= [] of DummyConnection @@connections.not_nil! << self @@ -113,6 +114,7 @@ class DummyDriver < DB::Driver end protected def perform_query(args : Enumerable) : DB::ResultSet + Fiber.yield @connection.as(DummyConnection).check set_params args DummyResultSet.new self, command @@ -161,6 +163,8 @@ class DummyDriver < DB::Driver def initialize(statement, command) super(statement) + Fiber.yield + @top_values = command.split.map { |r| r.split(',') }.to_a @column_count = @top_values.size > 0 ? @top_values[0].size : 2