Sha256: 527450e5781d9bb1a22a509eb056ae589a295f2c43182bd1e63f18f0d812f11e

Contents?: true

Size: 790 Bytes

Versions: 20

Compression:

Stored size: 790 Bytes

Contents

require_relative "test_helper"

class DangerousReindexTest < Minitest::Test
  def setup
    skip if mongoid2? || nobrainer? || activerecord_below41?
    super
  end

  def test_dangerous_reindex
    assert_raises(Searchkick::DangerousOperation) { Product.where(id: [1, 2, 3]).reindex }
  end

  def test_dangerous_index_associations
    Store.create!(name: "Test")
    assert_raises(Searchkick::DangerousOperation) { Store.first.products.reindex }
  end

  def test_dangerous_reindex_accepted
    store_names ["Product A", "Product B"]
    Product.where(name: "Product A").reindex(accept_danger: true)
    assert_search "product", ["Product A"]
  end

  def test_dangerous_reindex_inheritance
    assert_raises(Searchkick::DangerousOperation) { Dog.where(id: [1, 2, 3]).reindex }
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
searchkick-1.5.1 test/dangerous_reindex_test.rb
searchkick-1.5.0 test/dangerous_reindex_test.rb
searchkick-1.4.2 test/dangerous_reindex_test.rb
searchkick-1.4.1 test/dangerous_reindex_test.rb
searchkick-1.4.0 test/dangerous_reindex_test.rb
searchkick-1.3.6 test/dangerous_reindex_test.rb
searchkick-1.3.5 test/dangerous_reindex_test.rb
searchkick-1.3.4 test/dangerous_reindex_test.rb
searchkick-1.3.3 test/dangerous_reindex_test.rb
searchkick-1.3.2 test/dangerous_reindex_test.rb
searchkick_bharthur-0.0.2 test/dangerous_reindex_test.rb
searchkick_bharthur-0.0.1 test/dangerous_reindex_test.rb
searchkick-1.3.1 test/dangerous_reindex_test.rb
searchkick-1.3.0 test/dangerous_reindex_test.rb
searchkick-1.2.1 test/dangerous_reindex_test.rb
searchkick-1.2.0 test/dangerous_reindex_test.rb
searchkick-1.1.2 test/dangerous_reindex_test.rb
searchkick-1.1.1 test/dangerous_reindex_test.rb
searchkick-1.1.0 test/dangerous_reindex_test.rb
searchkick-1.0.3 test/dangerous_reindex_test.rb