Sha256: 31f93b0924af100215e76a2bd55706d0782601281cdde6b7f204940b00bb78ee

Contents?: true

Size: 774 Bytes

Versions: 5

Compression:

Stored size: 774 Bytes

Contents

require_relative "test_helper"

class TestReindexV2Job < Minitest::Test

  def setup
    skip if !defined?(ActiveJob)
    super
    Searchkick.disable_callbacks
  end

  def teardown
    Searchkick.enable_callbacks
  end

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

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

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
searchkick-0.8.7 test/reindex_v2_job_test.rb
searchkick-0.8.6 test/reindex_v2_job_test.rb
searchkick-0.8.5 test/reindex_v2_job_test.rb
searchkick-0.8.4 test/reindex_v2_job_test.rb
searchkick-0.8.3 test/reindex_v2_job_test.rb