1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2020-06-27 15:51:37 +02:00
parent 64d8c0815e
commit b3fa158d1c
35 changed files with 652 additions and 56 deletions

View file

@ -36,27 +36,31 @@ describe "Kernel.proc" do
end
describe "Kernel#proc" do
def some_method
proc
end
ruby_version_is ""..."2.7" do
it "uses the implicit block from an enclosing method" do
def some_method
proc
end
prc = some_method { "hello" }
prc.call.should == "hello"
end
end
ruby_version_is "2.7" ... "2.8" do
ruby_version_is "2.7"..."2.8" do
it "can be created when called with no block" do
def some_method
proc
end
-> {
some_method { "hello" }
}.should complain(/Capturing the given block using Kernel#proc is deprecated/)
end
end
ruby_version_is "2.8" 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
end
end