diff options
Diffstat (limited to 'spec/ruby')
| -rw-r--r-- | spec/ruby/core/proc/eql_spec.rb | 8 | ||||
| -rw-r--r-- | spec/ruby/core/proc/equal_value_spec.rb | 8 | ||||
| -rw-r--r-- | spec/ruby/core/proc/shared/equal.rb | 14 |
3 files changed, 21 insertions, 9 deletions
diff --git a/spec/ruby/core/proc/eql_spec.rb b/spec/ruby/core/proc/eql_spec.rb index a3c5a5658d..d95e890c29 100644 --- a/spec/ruby/core/proc/eql_spec.rb +++ b/spec/ruby/core/proc/eql_spec.rb @@ -2,5 +2,11 @@ require_relative '../../spec_helper' require_relative 'shared/equal' describe "Proc#eql?" do - it_behaves_like :proc_equal_undefined, :eql? + ruby_version_is "0"..."2.8" do + it_behaves_like :proc_equal_undefined, :eql? + end + + ruby_version_is "2.8" do + it_behaves_like :proc_equal, :eql? + end end diff --git a/spec/ruby/core/proc/equal_value_spec.rb b/spec/ruby/core/proc/equal_value_spec.rb index 1b6ac792cf..fb465992e9 100644 --- a/spec/ruby/core/proc/equal_value_spec.rb +++ b/spec/ruby/core/proc/equal_value_spec.rb @@ -2,5 +2,11 @@ require_relative '../../spec_helper' require_relative 'shared/equal' describe "Proc#==" do - it_behaves_like :proc_equal_undefined, :== + ruby_version_is "0"..."2.8" do + it_behaves_like :proc_equal_undefined, :== + end + + ruby_version_is "2.8" do + it_behaves_like :proc_equal, :== + end end diff --git a/spec/ruby/core/proc/shared/equal.rb b/spec/ruby/core/proc/shared/equal.rb index 46a1894424..0c0020ca7f 100644 --- a/spec/ruby/core/proc/shared/equal.rb +++ b/spec/ruby/core/proc/shared/equal.rb @@ -36,26 +36,26 @@ describe :proc_equal, shared: true do a.send(@method, b).should be_false end - it "returns true if both procs have the same body and environment" do + it "returns false if procs are distinct but have the same body and environment" do p = proc { :foo } p2 = proc { :foo } - p.send(@method, p2).should be_true + p.send(@method, p2).should be_false end - it "returns true if both lambdas with the same body and environment" do + it "returns false if lambdas are distinct but have same body and environment" do x = -> { :foo } x2 = -> { :foo } - x.send(@method, x2).should be_true + x.send(@method, x2).should be_false end - it "returns true if both different kinds of procs with the same body and env" do + it "returns false if using comparing lambda to proc, even with the same body and env" do p = -> { :foo } p2 = proc { :foo } - p.send(@method, p2).should be_true + p.send(@method, p2).should be_false x = proc { :bar } x2 = -> { :bar } - x.send(@method, x2).should be_true + x.send(@method, x2).should be_false end it "returns false if other is not a Proc" do |
