Sha256: 95ce67cded5ad4d28773cc35945de497c87688e0c6cc92df8be607e164ede382

Contents?: true

Size: 827 Bytes

Versions: 3

Compression:

Stored size: 827 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.strip_heredoc
        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

3 entries across 3 versions & 1 rubygems

Version Path
pg_search-2.3.2 spec/integration/deprecation_spec.rb
pg_search-2.3.1 spec/integration/deprecation_spec.rb
pg_search-2.3.0 spec/integration/deprecation_spec.rb