diff options
Diffstat (limited to 'spec/ruby/core/kernel/proc_spec.rb')
| -rw-r--r-- | spec/ruby/core/kernel/proc_spec.rb | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/spec/ruby/core/kernel/proc_spec.rb b/spec/ruby/core/kernel/proc_spec.rb index dfe178420b..1ba662177b 100644 --- a/spec/ruby/core/kernel/proc_spec.rb +++ b/spec/ruby/core/kernel/proc_spec.rb @@ -6,20 +6,20 @@ require_relative 'shared/lambda' describe "Kernel.proc" do it "is a private method" do - Kernel.should have_private_instance_method(:proc) + Kernel.private_instance_methods(false).should.include?(:proc) end it "creates a proc-style Proc if given a literal block" do l = proc { 42 } - l.lambda?.should be_false + l.lambda?.should == false end it "returned the passed Proc if given an existing Proc" do some_lambda = -> {} - some_lambda.lambda?.should be_true + some_lambda.lambda?.should == true l = proc(&some_lambda) - l.should equal(some_lambda) - l.lambda?.should be_true + l.should.equal?(some_lambda) + l.lambda?.should == true end it_behaves_like :kernel_lambda, :proc @@ -31,7 +31,7 @@ describe "Kernel.proc" do @reached_end_of_method = true end test - @reached_end_of_method.should be_nil + @reached_end_of_method.should == nil end end @@ -40,27 +40,9 @@ describe "Kernel#proc" do proc end - ruby_version_is ""..."2.7" do - it "uses the implicit block from an enclosing method" do - prc = some_method { "hello" } - - prc.call.should == "hello" - end - end - - ruby_version_is "2.7"..."3.0" do - it "can be created when called with no block" do - -> { - some_method { "hello" } - }.should complain(/Capturing the given block using Kernel#proc is deprecated/) - end - end - - ruby_version_is "3.0" do - it "raises an ArgumentError when passed no block" do - -> { - some_method { "hello" } - }.should raise_error(ArgumentError, 'tried to create Proc object without a block') - end + it "raises an ArgumentError when passed no block" do + -> { + some_method { "hello" } + }.should.raise(ArgumentError, 'tried to create Proc object without a block') end end |
