From 20516e69768928b83bad5b214ddc5b5e589ca5e6 Mon Sep 17 00:00:00 2001 From: lxxxvi Date: Sat, 10 Oct 2020 18:20:06 +0200 Subject: [PATCH 1/2] add spec for Range#=== to behave like Range#cover? in Ruby 2.7 --- core/range/case_compare_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/range/case_compare_spec.rb b/core/range/case_compare_spec.rb index 0ca03f6a35..b1afa90a41 100644 --- a/core/range/case_compare_spec.rb +++ b/core/range/case_compare_spec.rb @@ -25,4 +25,9 @@ (range === RangeSpecs::WithoutSucc.new(2)).should == true end end + + ruby_version_is "2.7" do + it_behaves_like :range_cover_and_include, :=== + it_behaves_like :range_cover, :=== + end end From 4cbc1b40fff23d3c20313351d39afecced407384 Mon Sep 17 00:00:00 2001 From: lxxxvi Date: Mon, 19 Oct 2020 15:26:39 +0200 Subject: [PATCH 2/2] move shared Range#cover? specs for subranges to own group PR #797 introduces specs for `:===` to behave like `:cover?`, except for subranges. In order to reuse the `describe :range_cover, shared: true` group for `:===`, it's been suggested to move specs related to subranges to its own group. --- core/range/cover_spec.rb | 1 + core/range/shared/cover.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/core/range/cover_spec.rb b/core/range/cover_spec.rb index 29c0e0bfa8..fa881607e9 100644 --- a/core/range/cover_spec.rb +++ b/core/range/cover_spec.rb @@ -6,4 +6,5 @@ describe "Range#cover?" do it_behaves_like :range_cover_and_include, :cover? it_behaves_like :range_cover, :cover? + it_behaves_like :range_cover_subrange, :cover? end diff --git a/core/range/shared/cover.rb b/core/range/shared/cover.rb index 33d416fef5..5b09cea4e0 100644 --- a/core/range/shared/cover.rb +++ b/core/range/shared/cover.rb @@ -90,7 +90,9 @@ end end end +end +describe :range_cover_subrange, shared: true do ruby_version_is "2.6" do context "range argument" do it "accepts range argument" do