From 5a9ab4a114f40d8efca617f6acb8bb7ddb048e38 Mon Sep 17 00:00:00 2001 From: Sean Collins Date: Thu, 11 Jul 2024 18:45:01 -0600 Subject: [PATCH] Change example to one that works (#134) 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)