Skip to content

Commit

Permalink
Test delegation of Relation to Array#intersect? only in Ruby >= 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
guilleiguaran committed Jun 21, 2023
1 parent 8725f61 commit 4366095
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions activerecord/test/cases/relation/delegation_test.rb
Expand Up @@ -9,7 +9,7 @@
module ActiveRecord
module DelegationTests
ARRAY_DELEGATES = [
:+, :-, :|, :&, :[], :shuffle, :intersect?,
:+, :-, :|, :&, :[], :shuffle,
:all?, :collect, :compact, :detect, :each, :each_cons, :each_with_index,
:exclude?, :find_all, :flat_map, :group_by, :include?, :length,
:map, :none?, :one?, :partition, :reject, :reverse, :rotate,
Expand All @@ -18,6 +18,8 @@ module DelegationTests
:in_groups, :in_groups_of, :to_sentence, :to_formatted_s, :to_fs, :as_json
]

ARRAY_DELEGATES << :intersect? if RUBY_VERSION >= "3.1.0"

ARRAY_DELEGATES.each do |method|
define_method "test_delegates_#{method}_to_Array" do
assert_respond_to target, method
Expand Down Expand Up @@ -53,7 +55,6 @@ def target
end
end


class QueryingMethodsDelegationTest < ActiveRecord::TestCase
QUERYING_METHODS =
ActiveRecord::Batches.public_instance_methods(false) +
Expand Down

0 comments on commit 4366095

Please sign in to comment.