From 5e7c43f0148904246523a12bb3710ae8d9162266 Mon Sep 17 00:00:00 2001 From: Peter Goldstein Date: Sun, 25 Dec 2022 10:09:21 -0500 Subject: [PATCH 1/3] Add Ruby 3.2 to the CI matrix. Also update checkout action version. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d64dce2..36812ec 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,7 @@ jobs: strategy: matrix: ruby-version: + - '3.2' - '3.1' - '3.0' - '2.7' @@ -27,7 +28,7 @@ jobs: - 6379:6379 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Ruby ${{ matrix.ruby-version }} uses: ruby/setup-ruby@v1 with: From ead2f5aa5c0928e8b3e8719136b3bab6c6ae1aa3 Mon Sep 17 00:00:00 2001 From: Peter Goldstein Date: Mon, 26 Dec 2022 20:32:37 -0500 Subject: [PATCH 2/3] Add explicit hashes to avoid ambiguity with keyword arguments --- spec/database_cleaner/cleaner_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/database_cleaner/cleaner_spec.rb b/spec/database_cleaner/cleaner_spec.rb index 8b62da1..1ae74df 100644 --- a/spec/database_cleaner/cleaner_spec.rb +++ b/spec/database_cleaner/cleaner_spec.rb @@ -98,7 +98,7 @@ module DatabaseCleaner end it "should pass all arguments to strategy initializer" do - expect(strategy_class).to receive(:new).with(:dollar, :amet, ipsum: "random").and_return(strategy) + expect(strategy_class).to receive(:new).with(:dollar, :amet, { ipsum: "random" }).and_return(strategy) expect(strategy).to receive(:clean) cleaner.clean_with :truncation, :dollar, :amet, ipsum: "random" end @@ -145,12 +145,12 @@ module DatabaseCleaner end it "should proxy params with symbolised strategies in an array" do - expect(strategy_class).to receive(:new).with(param: "one") + expect(strategy_class).to receive(:new).with({ param: "one" }) cleaner.strategy = [:truncation, param: "one"] end it "should proxy params with symbolised strategies in a separate hash" do - expect(strategy_class).to receive(:new).with(param: "one") + expect(strategy_class).to receive(:new).with({ param: "one" }) cleaner.strategy = :truncation, { param: "one" } end From b1434d2b9d0034470f6aee68c9b24168442099ac Mon Sep 17 00:00:00 2001 From: Peter Goldstein Date: Mon, 26 Dec 2022 20:51:48 -0500 Subject: [PATCH 3/3] Tweak safeguard so that empty strings are handled correctly --- lib/database_cleaner/safeguard.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/database_cleaner/safeguard.rb b/lib/database_cleaner/safeguard.rb index 353d0a7..2664679 100644 --- a/lib/database_cleaner/safeguard.rb +++ b/lib/database_cleaner/safeguard.rb @@ -53,12 +53,11 @@ module DatabaseCleaner def remote?(url) return false unless url - parsed = URI.parse(url) return false if parsed.scheme == 'sqlite3:' host = parsed.host - return false unless host + return false if host.nil? || host.empty? return false if LOCAL.include?(host) return false if host.end_with? '.local' true