Sha256: aeee2341d0c755e05896adf4611f4cc3b2fe24b9c2d7e7a5c170407983d384bf

Contents?: true

Size: 809 Bytes

Versions: 3

Compression:

Stored size: 809 Bytes

Contents

require_relative "test_helper"

class TestModel < Minitest::Test

  def test_disable_callbacks_model
    store_names ["product a"]

    Product.disable_search_callbacks
    assert !Product.search_callbacks?

    store_names ["product b"]
    assert_search "product", ["product a"]

    Product.enable_search_callbacks
    Product.reindex

    assert_search "product", ["product a", "product b"]
  end

  def test_disable_callbacks_global
    # make sure callbacks default to on
    assert Searchkick.callbacks?
    
    store_names ["product a"]

    Searchkick.disable_callbacks
    assert !Searchkick.callbacks?

    store_names ["product b"]
    assert_search "product", ["product a"]

    Searchkick.enable_callbacks
    Product.reindex

    assert_search "product", ["product a", "product b"]
  end

end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
searchkick-0.9.1 test/model_test.rb
searchkick-sinneduy-0.9.0 test/model_test.rb
searchkick-0.9.0 test/model_test.rb