Skip to content

Commit 631dba4

Browse files
committed
Stub also select_all
In Rails 7.1 :select no longer depends on :exect_query but relies on :internal_exec_query instead. So let's stub directly :select_all to fix the tests.
1 parent fdae98e commit 631dba4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/unit/solid_cache_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ def emulating_unavailability
5757
stub_matcher = ActiveRecord::Base.connection.class.any_instance
5858
stub_matcher.stubs(:exec_query).raises(ActiveRecord::StatementInvalid)
5959
stub_matcher.stubs(:exec_delete).raises(ActiveRecord::StatementInvalid)
60+
stub_matcher.stubs(:select_all).raises(ActiveRecord::StatementInvalid)
6061
yield ActiveSupport::Cache::SolidCacheStore.new(namespace: @namespace)
6162
ensure
6263
stub_matcher.unstub(:exec_query)
6364
stub_matcher.unstub(:exec_delete)
65+
stub_matcher.unstub(:select_all)
6466
end
6567
end
6668

@@ -82,10 +84,12 @@ def emulating_unavailability
8284
stub_matcher = ActiveRecord::Base.connection.class.any_instance
8385
stub_matcher.stubs(:exec_query).raises(ActiveRecord::StatementInvalid)
8486
stub_matcher.stubs(:exec_delete).raises(ActiveRecord::StatementInvalid)
87+
stub_matcher.stubs(:select_all).raises(ActiveRecord::StatementInvalid)
8588
yield ActiveSupport::Cache::SolidCacheStore.new(namespace: @namespace,
8689
error_handler: ->(method:, returning:, exception:) { raise exception })
8790
ensure
8891
stub_matcher.unstub(:exec_query)
8992
stub_matcher.unstub(:exec_delete)
93+
stub_matcher.unstub(:select_all)
9094
end
9195
end

0 commit comments

Comments
 (0)