From fe8f9f520648a2efbf40af15ece88061d92226ac Mon Sep 17 00:00:00 2001 From: Sven Schwyn Date: Thu, 7 Mar 2024 22:15:35 +0100 Subject: [PATCH] Update minitest-substitute to 1.0.0 and fix breaking changes --- spec/lib/rodbot/async_spec.rb | 2 +- spec/lib/rodbot/env_spec.rb | 8 ++++---- spec/lib/rodbot/generator_spec.rb | 2 +- spec/lib/rodbot/plugins_spec.rb | 2 +- spec/lib/rodbot/rack_spec.rb | 2 +- spec/lib/rodbot/relay_spec.rb | 14 +++++++------- spec/lib/rodbot/services/app_spec.rb | 8 ++++---- spec/lib/rodbot/services/relay_spec.rb | 8 ++++---- 8 files changed, 23 insertions(+), 23 deletions(-) diff --git a/spec/lib/rodbot/async_spec.rb b/spec/lib/rodbot/async_spec.rb index 8266ece..277932b 100644 --- a/spec/lib/rodbot/async_spec.rb +++ b/spec/lib/rodbot/async_spec.rb @@ -18,7 +18,7 @@ end it "yields as an asynchronous job in non-test environment" do - with '@current', 'production', on: Rodbot::Env do + substitute '@current', 'production', on: Rodbot::Env do yielded = false subject.perform { yielded = true } _(yielded).must_equal true diff --git a/spec/lib/rodbot/env_spec.rb b/spec/lib/rodbot/env_spec.rb index b0bd44d..765d963 100644 --- a/spec/lib/rodbot/env_spec.rb +++ b/spec/lib/rodbot/env_spec.rb @@ -46,7 +46,7 @@ end it "defaults to development" do - with "ENV['RODBOT_ENV']", 'unset or invalid' do + substitute "ENV['RODBOT_ENV']", 'unset or invalid' do _(subject).must_be :development? end end @@ -54,15 +54,15 @@ describe 'APP_ENV environment variable' do it "sets the environment" do - with "ENV['APP_ENV']", 'production' do - with "ENV['RODBOT_ENV']", nil do + substitute "ENV['APP_ENV']", 'production' do + substitute "ENV['RODBOT_ENV']", nil do _(subject).must_be :production? end end end it "RODBOT_ENV takes precedence" do - with "ENV['APP_ENV']", 'production' do + substitute "ENV['APP_ENV']", 'production' do _(subject).must_be :test? end end diff --git a/spec/lib/rodbot/generator_spec.rb b/spec/lib/rodbot/generator_spec.rb index cb7ccb3..982e0a3 100644 --- a/spec/lib/rodbot/generator_spec.rb +++ b/spec/lib/rodbot/generator_spec.rb @@ -108,7 +108,7 @@ end describe :relay_extensions do - with '@config', on: Rodbot do + substitute '@config', on: Rodbot do Rodbot::Config.new('plugin :matrix') end diff --git a/spec/lib/rodbot/plugins_spec.rb b/spec/lib/rodbot/plugins_spec.rb index 8a89212..7a01a43 100644 --- a/spec/lib/rodbot/plugins_spec.rb +++ b/spec/lib/rodbot/plugins_spec.rb @@ -37,7 +37,7 @@ def run(*) end describe :extend_relay do - with '@config', on: Rodbot do + substitute '@config', on: Rodbot do Rodbot::Config.new('plugin :matrix') end diff --git a/spec/lib/rodbot/rack_spec.rb b/spec/lib/rodbot/rack_spec.rb index 1b632e9..a8538de 100644 --- a/spec/lib/rodbot/rack_spec.rb +++ b/spec/lib/rodbot/rack_spec.rb @@ -24,7 +24,7 @@ def matched? describe Rodbot::Rack do describe :request do - with '::HTTPX', Minitest::HTTPX + substitute '::HTTPX', Minitest::HTTPX it "does a GET request to the full URL using HTTPX" do _(Rodbot.request('/search', params: { foo: 'bar' })).must_be :matched? diff --git a/spec/lib/rodbot/relay_spec.rb b/spec/lib/rodbot/relay_spec.rb index 105569d..ba83925 100644 --- a/spec/lib/rodbot/relay_spec.rb +++ b/spec/lib/rodbot/relay_spec.rb @@ -27,22 +27,22 @@ def write(message, extension) describe :bind do it "returns localhost and ports above 7200 by default" do - with '@config', Rodbot::Config.new("plugin :matrix; plugin :slack"), on: Rodbot do + substitute '@config', Rodbot::Config.new("plugin :matrix; plugin :slack"), on: Rodbot do _(matrix.send(:bind)).must_equal ['localhost', 7201] _(slack.send(:bind)).must_equal ['localhost', 7202] end end it "returns localhost and ports about explicit port config" do - with '@config', Rodbot::Config.new("plugin :matrix; plugin :slack; port 8888"), on: Rodbot do + substitute '@config', Rodbot::Config.new("plugin :matrix; plugin :slack; port 8888"), on: Rodbot do _(matrix.send(:bind)).must_equal ['localhost', 8889] _(slack.send(:bind)).must_equal ['localhost', 8890] end end it "returns value of RODBOT_RELAY_HOST and ports above 7200" do - with "ENV['RODBOT_RELAY_HOST']", '0.0.0.0' do - with '@config', Rodbot::Config.new("plugin :matrix; plugin :slack"), on: Rodbot do + substitute "ENV['RODBOT_RELAY_HOST']", '0.0.0.0' do + substitute '@config', Rodbot::Config.new("plugin :matrix; plugin :slack"), on: Rodbot do _(matrix.send(:bind)).must_equal ['0.0.0.0', 7201] _(slack.send(:bind)).must_equal ['0.0.0.0', 7202] end @@ -52,7 +52,7 @@ def write(message, extension) describe :say do context "all relay extensions have say enabled" do - with '@config', on: Rodbot do + substitute '@config', on: Rodbot do Rodbot::Config.new("plugin(:matrix) { say true }; plugin(:slack) { say true }") end @@ -68,7 +68,7 @@ def write(message, extension) end context "some relay extensions have say enabled" do - with '@config', on: Rodbot do + substitute '@config', on: Rodbot do Rodbot::Config.new("plugin(:matrix) { say true }; plugin(:slack)") end @@ -88,7 +88,7 @@ def write(message, extension) end context "no relay extensions have say enabled" do - with '@config', on: Rodbot do + substitute '@config', on: Rodbot do Rodbot::Config.new("plugin(:matrix); plugin(:slack)") end diff --git a/spec/lib/rodbot/services/app_spec.rb b/spec/lib/rodbot/services/app_spec.rb index b772777..dd0de24 100644 --- a/spec/lib/rodbot/services/app_spec.rb +++ b/spec/lib/rodbot/services/app_spec.rb @@ -11,13 +11,13 @@ end it "returns localhost and explicit port config" do - with '@config', Rodbot::Config.new("port 8888"), on: Rodbot do + substitute '@config', Rodbot::Config.new("port 8888"), on: Rodbot do _(subject.send(:bind)).must_equal ['localhost', 8888] end end it "returns value of RODBOT_APP_HOST and port 7200" do - with "ENV['RODBOT_APP_HOST']", 'app.local' do + substitute "ENV['RODBOT_APP_HOST']", 'app.local' do _(subject.send(:bind)).must_equal ['app.local', 7200] end end @@ -36,7 +36,7 @@ it "returns http://localhost and explicit port config" do Rodbot::Memoize::suspend do - with '@config', Rodbot::Config.new("port 8888"), on: Rodbot do + substitute '@config', Rodbot::Config.new("port 8888"), on: Rodbot do _(subject.url).must_equal 'http://localhost:8888' end end @@ -44,7 +44,7 @@ it "returns value of RODBOT_APP_URL and port 7200" do Rodbot::Memoize::suspend do - with "ENV['RODBOT_APP_URL']", 'https://app.local' do + substitute "ENV['RODBOT_APP_URL']", 'https://app.local' do _(subject.url).must_equal 'https://app.local:7200' end end diff --git a/spec/lib/rodbot/services/relay_spec.rb b/spec/lib/rodbot/services/relay_spec.rb index a089ff0..8ecfdee 100644 --- a/spec/lib/rodbot/services/relay_spec.rb +++ b/spec/lib/rodbot/services/relay_spec.rb @@ -8,7 +8,7 @@ describe :url do it "returns tcp://localhost and ports above 7200 by default" do Rodbot::Memoize::suspend do - with '@config', Rodbot::Config.new("plugin :matrix; plugin :slack"), on: Rodbot do + substitute '@config', Rodbot::Config.new("plugin :matrix; plugin :slack"), on: Rodbot do _(subject.url(:matrix)).must_equal 'tcp://localhost:7201' _(subject.url(:slack)).must_equal 'tcp://localhost:7202' end @@ -17,7 +17,7 @@ it "returns tcp://localhost and ports above explicit port config" do Rodbot::Memoize::suspend do - with '@config', Rodbot::Config.new("plugin :matrix; plugin :slack; port 8888"), on: Rodbot do + substitute '@config', Rodbot::Config.new("plugin :matrix; plugin :slack; port 8888"), on: Rodbot do _(subject.url(:matrix)).must_equal 'tcp://localhost:8889' _(subject.url(:slack)).must_equal 'tcp://localhost:8890' end @@ -26,8 +26,8 @@ it "returns value of RODBOT_RELAY_URL_XXX and ports above 7200" do Rodbot::Memoize::suspend do - with "ENV['RODBOT_RELAY_URL_MATRIX']", 'tcp://matrix.relay.local' do - with '@config', Rodbot::Config.new("plugin :matrix; plugin :slack"), on: Rodbot do + substitute "ENV['RODBOT_RELAY_URL_MATRIX']", 'tcp://matrix.relay.local' do + substitute '@config', Rodbot::Config.new("plugin :matrix; plugin :slack"), on: Rodbot do _(subject.url(:matrix)).must_equal 'tcp://matrix.relay.local:7201' _(subject.url(:slack)).must_equal 'tcp://localhost:7202' end