Skip to content

Commit 5a9ab4a

Browse files
authored
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
1 parent 68335b1 commit 5a9ab4a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

spec/unit/dry/cli/registry_spec.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828

2929
context "when class is given" do
3030
it "raises error when #initialize arity is not equal to 0" do
31-
callback = Struct
31+
callback = Class.new do
32+
def initialize(foo); end
33+
end
3234

3335
expect do
3436
Bar::CLI::Commands.before("alpha", callback)
@@ -64,7 +66,9 @@
6466

6567
context "when class is given" do
6668
it "raises error when #initialize arity is not equal to 0" do
67-
callback = Struct
69+
callback = Class.new do
70+
def initialize(foo); end
71+
end
6872

6973
expect do
7074
Bar::CLI::Commands.after("alpha", callback)

0 commit comments

Comments
 (0)