Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix spec to run with latest EM

  • Loading branch information...
commit 8d61568214bd74dafae772bffb4a7ce41565df12 1 parent d3e286d
@tmm1 tmm1 authored
Showing with 37 additions and 31 deletions.
  1. +37 −31 xmpp4em_spec.rb
View
68 xmpp4em_spec.rb
@@ -15,43 +15,49 @@ def wake
end
end
-describe 'XMPP4EM' do
- behaves_like 'eventmachine'
+EM.run{
+ Thread.new{
+ describe 'XMPP4EM' do
+ behaves_like 'eventmachine'
- @foo = XMPP4EM::Client.new('foo@localhost', 'test', :auto_register => true)
- @bar = XMPP4EM::Client.new('bar@localhost', 'test', :auto_register => true)
+ @foo = XMPP4EM::Client.new('foo@localhost', 'test', :auto_register => true)
+ @bar = XMPP4EM::Client.new('bar@localhost', 'test', :auto_register => true)
- should 'login to an xmpp server' do
- @foo.on(:login) do
- @foo.send Jabber::Presence.new
- wake
- end
+ should 'login to an xmpp server' do
+ @foo.on(:login) do
+ @foo.send Jabber::Presence.new
+ wake
+ end
- @foo.connect
- wait
-
- @foo.should.be.connected?
- end
+ @foo.connect
+ wait
- should 'send messages to others' do
- @bar.on(:login) do
- @bar.send Jabber::Presence.new do
- wake
+ @foo.should.be.connected?
end
- end
- received = nil
- @bar.on(:message) do |msg|
- received = msg.first_element_text('//body')
- wake
- end
+ should 'send messages to others' do
+ @bar.on(:login) do
+ @bar.send Jabber::Presence.new do
+ wake
+ end
+ end
- @bar.connect
- wait
+ received = nil
+ @bar.on(:message) do |msg|
+ received = msg.first_element_text('//body')
+ wake
+ end
- @foo.send_msg 'bar@localhost', 'hello'
- wait
+ @bar.connect
+ wait
- received.should == 'hello'
- end
-end
+ @foo.send_msg 'bar@localhost', 'hello'
+ wait
+
+ received.should == 'hello'
+ end
+
+ EM.stop_event_loop
+ end
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.