diff options
author | Benoit Daloze <eregontp@gmail.com> | 2023-06-26 15:55:11 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2023-06-26 15:55:11 +0200 |
commit | 515bd4214497b3af02f6eef51b496ad9a0cf6b3b (patch) | |
tree | 4554360d275a3bb9dc696f952b8f3d1bcd88f18a /spec/ruby/core/proc/new_spec.rb | |
parent | f73fa299279ac322bd921691d1ba0e8bf2b39b5f (diff) | |
download | ruby-515bd4214497b3af02f6eef51b496ad9a0cf6b3b.tar.gz |
Update to ruby/spec@30e1c35
Diffstat (limited to 'spec/ruby/core/proc/new_spec.rb')
-rw-r--r-- | spec/ruby/core/proc/new_spec.rb | 35 |
1 files changed, 6 insertions, 29 deletions
diff --git a/spec/ruby/core/proc/new_spec.rb b/spec/ruby/core/proc/new_spec.rb index cb52e94f44..b2b7387756 100644 --- a/spec/ruby/core/proc/new_spec.rb +++ b/spec/ruby/core/proc/new_spec.rb @@ -166,36 +166,13 @@ describe "Proc.new without a block" do -> { ProcSpecs.new_proc_subclass_in_method }.should raise_error(ArgumentError) end - ruby_version_is ""..."3.0" do - it "can be created if invoked from within a method with a block" do - -> { ProcSpecs.new_proc_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/) - end - - it "can be created if invoked on a subclass from within a method with a block" do - -> { ProcSpecs.new_proc_subclass_in_method { "hello" } }.should complain(/Capturing the given block using Proc.new is deprecated/) - end - - - it "can be create when called with no block" do - def some_method - Proc.new - end - - -> { - some_method { "hello" } - }.should complain(/Capturing the given block using Proc.new is deprecated/) + it "raises an ArgumentError when passed no block" do + def some_method + Proc.new end - end - ruby_version_is "3.0" do - it "raises an ArgumentError when passed no block" do - def some_method - Proc.new - end - - -> { ProcSpecs.new_proc_in_method { "hello" } }.should raise_error(ArgumentError, 'tried to create Proc object without a block') - -> { ProcSpecs.new_proc_subclass_in_method { "hello" } }.should raise_error(ArgumentError, 'tried to create Proc object without a block') - -> { some_method { "hello" } }.should raise_error(ArgumentError, 'tried to create Proc object without a block') - end + -> { ProcSpecs.new_proc_in_method { "hello" } }.should raise_error(ArgumentError, 'tried to create Proc object without a block') + -> { ProcSpecs.new_proc_subclass_in_method { "hello" } }.should raise_error(ArgumentError, 'tried to create Proc object without a block') + -> { some_method { "hello" } }.should raise_error(ArgumentError, 'tried to create Proc object without a block') end end |