From 2d7bde0b4fa805c881c5e0ea88930d61a9193f5c Mon Sep 17 00:00:00 2001 From: Christopher Vollick <0@psycoti.ca> Date: Tue, 27 May 2025 12:06:03 -0400 Subject: [PATCH] Remove Redundant Mock from Test This started because Rubocop told me it didn't like OpenStruct. Okay, whatever. But then while writings a mock, I realized that the OpenStruct had a key of "name", but the code looked like it was looking for a value called "plan_name". Weird. With a bit more tracing it looks like the only thing this DB is used for is `customer_plan`, and _that_ only gets called in the constructor, which isn't being created in this test, it's being created in the setup. And also it doesn't use the customer plan when a currency gets passed in, since that's all it's using it for, and our tests are passing a currency in. So this mock was the wrong format, but that didn't matter because the code that would have used it wasn't being run, but if it was run it'd be run before this mock was constructed. --- test/test_credit_card_customer_gateway.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/test/test_credit_card_customer_gateway.rb b/test/test_credit_card_customer_gateway.rb index ce95ec72acb523102133a760e1af5d1fe655a5f2..28cf4e873c358cfe05ecde8cb8be8d88f3055f35 100644 --- a/test/test_credit_card_customer_gateway.rb +++ b/test/test_credit_card_customer_gateway.rb @@ -13,7 +13,6 @@ class CreditCardCustomerGatewayTest < Minitest::Test def test_no_cc_for_tombed Customer::REDIS.expect(:get, "Tombed", ["jmp_customer_trust_level-0001"]) - CreditCardCustomerGateway::DB.expect(:exec_params, [OpenStruct.new(name: "plan_name")]) assert_raises RuntimeError do @gateway.sale("nonce", 1000) end