elastic_searchable 0.6.7 → 0.6.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -44,6 +44,8 @@ module ElasticSearchable
|
|
44
44
|
# http://www.elasticsearch.com/docs/elasticsearch/rest_api/delete/
|
45
45
|
def delete_id_from_index(id)
|
46
46
|
ElasticSearchable.request :delete, index_type_path(id)
|
47
|
+
rescue ElasticSearchable::ElasticError => e
|
48
|
+
ElasticSearchable.logger.warn e
|
47
49
|
end
|
48
50
|
|
49
51
|
# helper method to generate elasticsearch url for this object type
|
@@ -54,14 +54,6 @@ class TestElasticSearchable < Test::Unit::TestCase
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
-
context 'deleting object that does not exist in search index' do
|
58
|
-
should 'raise error' do
|
59
|
-
assert_raises ElasticSearchable::ElasticError do
|
60
|
-
Post.delete_id_from_index 123
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
57
|
context 'Model.create' do
|
66
58
|
setup do
|
67
59
|
@post = Post.create :title => 'foo', :body => "bar"
|
@@ -80,11 +72,20 @@ class TestElasticSearchable < Test::Unit::TestCase
|
|
80
72
|
Post.create_index
|
81
73
|
@first_post = Post.create :title => 'foo', :body => "first bar"
|
82
74
|
@second_post = Post.create :title => 'foo', :body => "second bar"
|
83
|
-
Post.
|
75
|
+
Post.delete_index
|
76
|
+
Post.create_index
|
84
77
|
end
|
85
78
|
should 'not raise error if error occurs reindexing model' do
|
86
79
|
ElasticSearchable.expects(:request).raises(ElasticSearchable::ElasticError.new('faux error'))
|
87
|
-
|
80
|
+
assert_nothing_raised do
|
81
|
+
Post.reindex
|
82
|
+
end
|
83
|
+
end
|
84
|
+
should 'not raise error if destroying one instance' do
|
85
|
+
Logger.any_instance.expects(:warn)
|
86
|
+
assert_nothing_raised do
|
87
|
+
@first_post.destroy
|
88
|
+
end
|
88
89
|
end
|
89
90
|
context 'Model.reindex' do
|
90
91
|
setup do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elastic_searchable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 8
|
10
|
+
version: 0.6.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Sonnek
|