From f68242170ee00ad095c6bbe88152327f59b429cd Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Tue, 21 Jun 2011 21:40:59 +0100 Subject: [PATCH] Test now checks that we get 'ready!' from em-bitcoin to the actor --- spec/em-bitcoin_spec.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/spec/em-bitcoin_spec.rb b/spec/em-bitcoin_spec.rb index f0de26f..19703fb 100644 --- a/spec/em-bitcoin_spec.rb +++ b/spec/em-bitcoin_spec.rb @@ -35,13 +35,20 @@ class MockActor end def ready! + log(:info, "Received ready! call from em-bitcoin") @ready = true + @on_ready.call end def ready? @ready == true end + # triggers for various events + def on_ready(&blk) + @on_ready = blk + end + protected attr_accessor :name @@ -85,13 +92,11 @@ describe BitcoinClient do start_server start_client - done + @client_actor.on_ready do + @client_actor.connection.should_not == nil + done + end -# EM::add_periodic_timer(2) do -# @client_actor.should_receive(:ready!).and_return(true) -# @client_actor.should_receive(:connection=).with(@client).and_return(true) -# done -# end end end end