spec/integration/deprecation_spec.rb in pg_search-2.3.6 vs spec/integration/deprecation_spec.rb in pg_search-2.3.7

- old
+ new

@@ -1,13 +1,14 @@ # frozen_string_literal: true require "spec_helper" +require "active_support/core_ext/kernel/reporting" describe "Including the deprecated PgSearch module" do with_model :SomeModel do model do - ActiveSupport::Deprecation.silence do + silence_warnings do include PgSearch end end end @@ -16,18 +17,16 @@ it "includes PgSearch::Model" do expect(SomeModel.ancestors).to include PgSearch::Model end it "prints a deprecation message" do - allow(ActiveSupport::Deprecation).to receive(:warn) + allow(PgSearch).to receive(:warn) AnotherModel.include(PgSearch) - expect(ActiveSupport::Deprecation).to have_received(:warn).with( - <<~MESSAGE - Directly including `PgSearch` into an Active Record model is deprecated and will be removed in pg_search 3.0. + expect(PgSearch).to have_received(:warn).with(<<~MESSAGE, category: :deprecated, uplevel: 1) + Directly including `PgSearch` into an Active Record model is deprecated and will be removed in pg_search 3.0. - Please replace `include PgSearch` with `include PgSearch::Model`. - MESSAGE - ) + Please replace `include PgSearch` with `include PgSearch::Model`. + MESSAGE end end