Created
January 1, 2012 19:35
-
-
Save jimsynz/1548132 to your computer and use it in GitHub Desktop.
For the life of me I can't make this work...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shared_examples_for "a Faye server" do | |
self.use_transactional_fixtures = false | |
it "should have Event Machine reactor running" do | |
EM.reactor_running?.should be_true | |
end # Passes. | |
it "should be able to subscribe to channel" do | |
channel = "/random/#{rand(65534).to_s}" | |
message = "Successful subscription." | |
result = "Unsuccessful subscription." | |
Fiber.new do | |
client.subscribe(channel) do |msg| | |
result = msg | |
Fiber.current.resume | |
end | |
EM.defer do | |
FayeRails.client.publish(channel, message) | |
end | |
EM.add_timer(5) do | |
result = "Subscription timed out." | |
Fiber.current.resume | |
end | |
Fiber.yield | |
end.resume | |
result.should == message | |
end # Fails | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment