Skip to content

Commit 2a98617

Browse files
lizkenyonclaude
andcommitted
Fix Ruby 3.4 compatibility in billing error tests
Ruby 3.4 changed the hash inspection format from {:key=>"value"} to {key: "value"}. Updated the mocha expectations to use regex patterns that match both formats. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9228701 commit 2a98617

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/controllers/concerns/ensure_billing_test.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ def index
248248
)
249249
@controller.stubs(:run_query).raises(ShopifyApp::BillingError.new("Billing error", { errors: "not good" }))
250250

251-
ShopifyApp::Logger.expects(:warn).with("Encountered billing error - Billing error: {:errors=>\"not good\"}"\
252-
"\nRedirecting to login page")
251+
error_pattern = /Encountered billing error - Billing error: \{(:)?errors(:|=>)\s?"not good"\}\n/
252+
error_pattern = Regexp.new(error_pattern.source + "Redirecting to login page")
253+
ShopifyApp::Logger.expects(:warn).with(regexp_matches(error_pattern))
253254

254255
get :index, xhr: true
255256

@@ -268,8 +269,9 @@ def index
268269
@controller.stubs(:run_query).raises(ShopifyApp::BillingError.new("Billing error", { errors: "not good" }))
269270

270271
@controller.expects(:fullpage_redirect_to).with(ShopifyApp.configuration.login_url)
271-
ShopifyApp::Logger.expects(:warn).with("Encountered billing error - Billing error: {:errors=>\"not good\"}"\
272-
"\nRedirecting to login page")
272+
error_pattern = /Encountered billing error - Billing error: \{(:)?errors(:|=>)\s?"not good"\}\n/
273+
error_pattern = Regexp.new(error_pattern.source + "Redirecting to login page")
274+
ShopifyApp::Logger.expects(:warn).with(regexp_matches(error_pattern))
273275

274276
get :index
275277
end

0 commit comments

Comments
 (0)