summaryrefslogtreecommitdiff
path: root/spec/ruby/language/lambda_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language/lambda_spec.rb')
-rw-r--r--spec/ruby/language/lambda_spec.rb27
1 files changed, 19 insertions, 8 deletions
diff --git a/spec/ruby/language/lambda_spec.rb b/spec/ruby/language/lambda_spec.rb
index 3934a2bd91..7114a38e5c 100644
--- a/spec/ruby/language/lambda_spec.rb
+++ b/spec/ruby/language/lambda_spec.rb
@@ -310,14 +310,25 @@ describe "A lambda expression 'lambda { ... }'" do
def meth; lambda; end
end
- it "can be created" do
- implicit_lambda = nil
- -> {
- implicit_lambda = meth { 1 }
- }.should complain(/tried to create Proc object without a block/)
-
- implicit_lambda.lambda?.should be_true
- implicit_lambda.call.should == 1
+ ruby_version_is ""..."2.7" do
+ it "can be created" do
+ implicit_lambda = nil
+ -> {
+ implicit_lambda = meth { 1 }
+ }.should complain(/tried to create Proc object without a block/)
+
+ implicit_lambda.lambda?.should be_true
+ implicit_lambda.call.should == 1
+ end
+ end
+
+ ruby_version_is "2.7" do
+ it "raises ArgumentError" do
+ implicit_lambda = nil
+ -> {
+ meth { 1 }
+ }.should raise_error(ArgumentError, /tried to create Proc object without a block/)
+ end
end
end