From 8cf5342eef3228de3fdfc1ddcf907f043c1a84ef Mon Sep 17 00:00:00 2001 From: Travis Jefferson Date: Mon, 21 Nov 2022 13:32:39 -0500 Subject: [PATCH] Failing test for options hash / kwarg compat Only this time, it's in the initializer! --- test/safe/of_next_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/safe/of_next_test.rb b/test/safe/of_next_test.rb index e356e61..5a510de 100644 --- a/test/safe/of_next_test.rb +++ b/test/safe/of_next_test.rb @@ -19,6 +19,12 @@ def initialize(a, b:) end end + class OptionsHash + def initialize(opts = {}) + raise "options hash required!" + end + end + def test_of_next neato_mocktail = Mocktail.of_next(Neato) next_neato = Neato.new @@ -52,6 +58,12 @@ def test_of_next_multiples_then_returns_to_replaced_version assert Neato.new.to_s.include?("Mocktail") end + def test_options_hash_initializer + thing = Mocktail.of_next(OptionsHash) + + assert_equal thing, OptionsHash.new(item: "hello") + end + module AModule end