Sha256: 409a1d33da2228f49d7f6a808b77ee5d6bb68cfc0c0c112f79f042ec65e4ef22

Contents?: true

Size: 772 Bytes

Versions: 6

Compression:

Stored size: 772 Bytes

Contents

require_relative "test_helper"

class ReindexV2JobTest < Minitest::Test
  def setup
    skip unless defined?(ActiveJob)
    super
  end

  def test_create
    product = Searchkick.callbacks(false) { Product.create!(name: "Boom") }
    Product.search_index.refresh
    assert_search "*", []
    Searchkick::ReindexV2Job.perform_later("Product", product.id.to_s)
    Product.search_index.refresh
    assert_search "*", ["Boom"]
  end

  def test_destroy
    product = Searchkick.callbacks(false) { Product.create!(name: "Boom") }
    Product.reindex
    assert_search "*", ["Boom"]
    Searchkick.callbacks(false) { product.destroy }
    Searchkick::ReindexV2Job.perform_later("Product", product.id.to_s)
    Product.search_index.refresh
    assert_search "*", []
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
searchkick-3.1.0 test/reindex_v2_job_test.rb
searchkick-3.0.3 test/reindex_v2_job_test.rb
searchkick_evichat-0.0.2 test/reindex_v2_job_test.rb
searchkick-3.0.2 test/reindex_v2_job_test.rb
searchkick-3.0.1 test/reindex_v2_job_test.rb
searchkick-3.0.0 test/reindex_v2_job_test.rb