add em_fiber spec

This commit is contained in:
dan sinclair 2010-11-26 22:42:09 -05:00
parent c2e2f0c46c
commit 9d49728c30
1 changed files with 22 additions and 0 deletions

22
spec/em/em_fiber_spec.rb Normal file
View File

@ -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