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