From 298ff66022f9c398908640d178aff8934c249899 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 7 Sep 2022 13:07:14 -0500 Subject: [PATCH] Update to new minitest --- Gemfile | 2 +- test/test_customer_info.rb | 2 +- test/test_low_balance.rb | 8 ++++---- test/test_registration.rb | 2 +- test/test_transaction.rb | 23 ++++++++++++----------- test/test_web.rb | 36 ++++++++++++++++-------------------- 6 files changed, 35 insertions(+), 38 deletions(-) diff --git a/Gemfile b/Gemfile index fe7b6410c7754292f5a93f066ea386be8afb1b79..c9623ae3dc918289b6f1b8c1e9a17d8e8b830fbf 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ group(:development) do end group(:test) do - gem "minitest", "<= 5.15.0" + gem "minitest", ">= 5.16.0" gem "rack-test" gem "rake" gem "rantly" diff --git a/test/test_customer_info.rb b/test/test_customer_info.rb index ae121a4504c58bd55d7f399f209a8ec5e4d64669..727137537070c32522f6a50b53ff7c892071daab 100644 --- a/test/test_customer_info.rb +++ b/test/test_customer_info.rb @@ -75,7 +75,7 @@ class CustomerInfoTest < Minitest::Test call_attempt_repo.expect( :find_outbound, CallAttempt::Unsupported.new(direction: :outbound), - [cust, "+1", { call_id: "dry_run" }] + [cust, "+1"], call_id: "dry_run" ) trust_repo = Minitest::Mock.new diff --git a/test/test_low_balance.rb b/test/test_low_balance.rb index 540740b24640369e0043f0e033136f79c7f4d71e..f31380635ccf0f6fa6199f06b413cfb0e12e2fb9 100644 --- a/test/test_low_balance.rb +++ b/test/test_low_balance.rb @@ -131,7 +131,7 @@ class LowBalanceTest < Minitest::Test LowBalance::AutoTopUp::Transaction.expect( :sale, tx, - [@customer, { amount: 100 }] + [@customer], amount: 100 ) @auto_top_up.notify! assert_mock tx @@ -150,7 +150,7 @@ class LowBalanceTest < Minitest::Test LowBalance::AutoTopUp::Transaction.expect( :sale, tx, - [customer, { amount: 115 }] + [customer], amount: 115 ) auto_top_up.notify! assert_mock tx @@ -169,7 +169,7 @@ class LowBalanceTest < Minitest::Test LowBalance::AutoTopUp::Transaction.expect( :sale, tx, - [customer, { amount: 26 }] + [customer], amount: 26 ) auto_top_up.notify! assert_mock tx @@ -190,7 +190,7 @@ class LowBalanceTest < Minitest::Test LowBalance::AutoTopUp::Transaction.expect( :sale, EMPromise.reject(RuntimeError.new("test")), - [@customer, { amount: 100 }] + [@customer], amount: 100 ) @auto_top_up.notify!.sync assert_mock @customer diff --git a/test/test_registration.rb b/test/test_registration.rb index c711411f8963ef911c1d90d87d6aa3b4114aa5cf..9a677d8728f86def8322153fee6d72beba94fe11 100644 --- a/test/test_registration.rb +++ b/test/test_registration.rb @@ -435,7 +435,7 @@ class RegistrationTest < Minitest::Test customer.expect( :bill_plan, nil, - [{ note: "Bill +15555550000 for first month" }] + note: "Bill +15555550000 for first month" ) Registration::Payment::CreditCard::Activate::Finish.expect( :new, diff --git a/test/test_transaction.rb b/test/test_transaction.rb index f2b2725b9020c46eeb6db2eabdbbbe329ec16a90..0829918ebf16f9286fc37d19d3a9626ef7a7cc76 100644 --- a/test/test_transaction.rb +++ b/test/test_transaction.rb @@ -33,7 +33,7 @@ class TransactionTest < Minitest::Test TrustLevelRepo::DB.expect( :query_one, EMPromise.resolve({}), - [String, "test", Hash] + [String, "test"], default: {} ) CustomerFinancials::REDIS.expect( :get, @@ -57,9 +57,12 @@ class TransactionTest < Minitest::Test EMPromise.resolve( OpenStruct.new(success?: false, message: "declined") ), - [Hash] + amount: 99, + merchant_account_id: "merchant_usd", + options: { submit_for_settlement: true }, + payment_method_token: "token" ) - assert_raises("declined") do + assert_raises(RuntimeError) do Transaction.sale( customer(plan_name: "test_usd"), amount: 99, @@ -87,7 +90,7 @@ class TransactionTest < Minitest::Test TrustLevelRepo::DB.expect( :query_one, EMPromise.resolve({}), - [String, "test", Hash] + [String, "test"], default: {} ) CustomerFinancials::REDIS.expect( :get, @@ -122,7 +125,7 @@ class TransactionTest < Minitest::Test TrustLevelRepo::DB.expect( :query_one, EMPromise.resolve({}), - [String, "test", Hash] + [String, "test"], default: {} ) CustomerFinancials::REDIS.expect( :get, @@ -139,12 +142,10 @@ class TransactionTest < Minitest::Test transaction: FAKE_BRAINTREE_TRANSACTION ) ), - [{ - amount: 99, - payment_method_token: "token", - merchant_account_id: "merchant_usd", - options: { submit_for_settlement: true } - }] + amount: 99, + payment_method_token: "token", + merchant_account_id: "merchant_usd", + options: { submit_for_settlement: true } ) Transaction::REDIS.expect( :setex, diff --git a/test/test_web.rb b/test/test_web.rb index 9d53fb8e6a7e92c70fd27696fc8693d878419c3e..3cfe8280c8d0d02245d7e5450bb0a53dbf68141f 100644 --- a/test/test_web.rb +++ b/test/test_web.rb @@ -161,7 +161,7 @@ class WebTest < Minitest::Test EMPromise.resolve( OpenStruct.new(insert: EMPromise.resolve(nil), total: 15) ), - [Customer, { amount: 15 }] + [Customer], amount: 15 ) ExpiringLock::REDIS.expect( @@ -291,16 +291,13 @@ class WebTest < Minitest::Test CustomerFwd::BANDWIDTH_VOICE.expect( :create_call, OpenStruct.new(data: OpenStruct.new(call_id: "ocall")), - [ - "test_bw_account", - Matching.new do |arg| - assert_equal( - "http://example.org/inbound/calls/acall?customer_id=customerid", - arg[:body].answer_url - ) - assert_equal [:body], arg.keys - end - ] + ["test_bw_account"], + body: Matching.new do |arg| + assert_equal( + "http://example.org/inbound/calls/acall?customer_id=customerid", + arg.answer_url + ) + end ) post( @@ -429,15 +426,14 @@ class WebTest < Minitest::Test nil, [ "test_bw_account", - "bcall", - Matching.new do |arg| - assert_equal [:body], arg.keys - assert_equal( - "http://example.org/inbound/calls/oocall/voicemail", - arg[:body].redirect_url - ) - end - ] + "bcall" + ], + body: Matching.new do |arg| + assert_equal( + "http://example.org/inbound/calls/oocall/voicemail", + arg.redirect_url + ) + end ) post(