Sha256: 2f867cec14c6860968e57827d15ffb339abacc81c17ba507ca260466f403499c

Contents?: true

Size: 813 Bytes

Versions: 4

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe "Including the deprecated PgSearch module" do
  with_model :SomeModel do
    model do
      ActiveSupport::Deprecation.silence do
        include PgSearch
      end
    end
  end

  with_model :AnotherModel

  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)

    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.

        Please replace `include PgSearch` with `include PgSearch::Model`.
      MESSAGE
    )
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pg_search-2.3.6 spec/integration/deprecation_spec.rb
pg_search-2.3.5 spec/integration/deprecation_spec.rb
pg_search-2.3.4 spec/integration/deprecation_spec.rb
pg_search-2.3.3 spec/integration/deprecation_spec.rb