From 9d49728c3074d6bc18fbeaa48aa20f233a2f5f9e Mon Sep 17 00:00:00 2001 From: dan sinclair Date: Fri, 26 Nov 2010 22:42:09 -0500 Subject: [PATCH] add em_fiber spec --- spec/em/em_fiber_spec.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 spec/em/em_fiber_spec.rb diff --git a/spec/em/em_fiber_spec.rb b/spec/em/em_fiber_spec.rb new file mode 100644 index 0000000..91b294e --- /dev/null +++ b/spec/em/em_fiber_spec.rb @@ -0,0 +1,22 @@ +# encoding: UTF-8 +if defined? EventMachine && defined? Fiber + require 'spec_helper' + require 'mysql2/em_fiber' + + describe Mysql2::EM::Fiber::Client do + it 'should support queries' do + results = [] + EM.run do + Fiber.new { + client1 = Mysql2::EM::Fiber::Client.new + results = client1.query "SELECT sleep(0.1) as first_query" + EM.stop_event_loop + }.resume + end + + results.first.keys.should include("first_query") + end + end +else + puts "Either EventMachine or Fibers not available. Skipping tests that use them." +end \ No newline at end of file