From 13cba1d164907e5153fbd6d3618da20d2b5e57a4 Mon Sep 17 00:00:00 2001 From: Abdullah Alhusaini Date: Mon, 29 Jul 2024 22:45:58 +0300 Subject: [PATCH 1/2] clarify startup message in test mode --- src/kemal.cr | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/kemal.cr b/src/kemal.cr index 98bf3245..bf7af656 100644 --- a/src/kemal.cr +++ b/src/kemal.cr @@ -66,8 +66,12 @@ module Kemal end def self.display_startup_message(config, server) - addresses = server.addresses.join ", " { |address| "#{config.scheme}://#{address}" } - log "[#{config.env}] #{config.app_name} is ready to lead at #{addresses}" + if config.env != "test" + addresses = server.addresses.join ", " { |address| "#{config.scheme}://#{address}" } + log "[#{config.env}] #{config.app_name} is ready to lead at #{addresses}" + else + log "[#{config.env}] #{config.app_name} is running in test mode. Server not listening" + end end def self.stop From e573997f76ac0335d989360c8fe886470a1536b4 Mon Sep 17 00:00:00 2001 From: Abdullah Alhusaini Date: Mon, 29 Jul 2024 23:01:52 +0300 Subject: [PATCH 2/2] fixed invalid speccs --- spec/run_spec.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/run_spec.cr b/spec/run_spec.cr index ec89d233..a629eac3 100644 --- a/spec/run_spec.cr +++ b/spec/run_spec.cr @@ -26,7 +26,7 @@ describe "Run" do end it "runs without a block being specified" do - run(<<-CR).should eq "[test] Kemal is ready to lead at http://0.0.0.0:3000\ntrue\n" + run(<<-CR).should contain "[test] Kemal is running in test mode." Kemal.config.env = "test" Kemal.run puts Kemal.config.running @@ -34,7 +34,7 @@ describe "Run" do end it "allows custom HTTP::Server bind" do - run(<<-CR).should eq "[test] Kemal is ready to lead at http://127.0.0.1:3000, http://0.0.0.0:3001\n" + run(<<-CR).should contain "[test] Kemal is running in test mode." Kemal.config.env = "test" Kemal.run do |config| server = config.server.not_nil!