Skip to content

Commit

Permalink
Change example to one that works
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cllns committed Jul 10, 2024
1 parent 9731807 commit 848e6b1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions spec/unit/dry/cli/registry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 848e6b1

Please sign in to comment.