diff --git a/spec/chat_server_helper.rb b/spec/chat_server_helper.rb index 75203f2..d104ad4 100644 --- a/spec/chat_server_helper.rb +++ b/spec/chat_server_helper.rb @@ -10,17 +10,22 @@ MessageBus.config[:backend] = :memory # Run the Chat Sinatra app. -require "#{chat_example_path}/chat" +require File.join(chat_example_path, 'chat') RSpec.configure do |config| config.around(:all) do |example| + Thread.abort_on_exception = true server = Thread.new { Chat.run! } retries = 0 begin Socket.tcp('localhost', 9292, connect_timeout: 1) rescue Errno::ECONNREFUSED - sleep 1 && retry if (retries = retries.succ) < 10 + if (retries = retries.succ) < 10 + warn 'waiting for chat server to start on localhost:9292' + sleep 1 + retry + end end example.run