Commit dd85a230037105560804dedb6089e47833f09d95

Authored by Andrew Kane
1 parent 22a3c9e1

Moved test [skip ci]

Showing 2 changed files with 17 additions and 20 deletions   Show diff stats
test/errors_test.rb
@@ -1,20 +0,0 @@ @@ -1,20 +0,0 @@
1 -require_relative "test_helper"  
2 -  
3 -class ErrorsTest < Minitest::Test  
4 - def test_bulk_import_raises_error  
5 - valid_dog = Product.create(name: "2016-01-02")  
6 - invalid_dog = Product.create(name: "Ol' One-Leg")  
7 - mapping = {  
8 - properties: {  
9 - name: {type: "date"}  
10 - }  
11 - }  
12 - index = Searchkick::Index.new "dogs", mappings: mapping, _type: "dog"  
13 - index.delete if index.exists?  
14 - index.create_index  
15 - index.store valid_dog  
16 - assert_raises(Searchkick::ImportError) do  
17 - index.bulk_index [valid_dog, invalid_dog]  
18 - end  
19 - end  
20 -end  
test/index_test.rb
@@ -105,4 +105,21 @@ class IndexTest &lt; Minitest::Test @@ -105,4 +105,21 @@ class IndexTest &lt; Minitest::Test
105 # values that exceed ignore_above are not included in _all field :( 105 # values that exceed ignore_above are not included in _all field :(
106 # assert_search "hello", ["Product A"], {}, Region 106 # assert_search "hello", ["Product A"], {}, Region
107 end 107 end
  108 +
  109 + def test_bulk_import_raises_error
  110 + valid_dog = Product.create(name: "2016-01-02")
  111 + invalid_dog = Product.create(name: "Ol' One-Leg")
  112 + mapping = {
  113 + properties: {
  114 + name: {type: "date"}
  115 + }
  116 + }
  117 + index = Searchkick::Index.new "dogs", mappings: mapping, _type: "dog"
  118 + index.delete if index.exists?
  119 + index.create_index
  120 + index.store valid_dog
  121 + assert_raises(Searchkick::ImportError) do
  122 + index.bulk_index [valid_dog, invalid_dog]
  123 + end
  124 + end
108 end 125 end