From 848e6b1d000434029703a13c72876481a0eebc9c Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Tue, 9 Jul 2024 22:35:43 -0600 Subject: [PATCH] Change example to one that works Struct.new used to raise an error in Ruby 3.2 and earlier, but in 3.3 it's allowed. So we make a new class that actually requires an arg --- spec/unit/dry/cli/registry_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/unit/dry/cli/registry_spec.rb b/spec/unit/dry/cli/registry_spec.rb index d6511f3..2c28d76 100644 --- a/spec/unit/dry/cli/registry_spec.rb +++ b/spec/unit/dry/cli/registry_spec.rb @@ -28,7 +28,9 @@ context "when class is given" do it "raises error when #initialize arity is not equal to 0" do - callback = Struct + callback = Class.new do + def initialize(foo); end + end expect do Bar::CLI::Commands.before("alpha", callback) @@ -64,7 +66,9 @@ context "when class is given" do it "raises error when #initialize arity is not equal to 0" do - callback = Struct + callback = Class.new do + def initialize(foo); end + end expect do Bar::CLI::Commands.after("alpha", callback)