forked from elastic/elasticsearch-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepository_indexing_test.rb
37 lines (30 loc) · 1.08 KB
/
repository_indexing_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'test_helper'
class Elasticsearch::Persistence::RepositoryIndexingTest < Test::Unit::TestCase
context "The repository index methods" do
class MyDocument; end
setup do
@shoulda_subject = Class.new() { include Elasticsearch::Model::Indexing::ClassMethods }.new
@shoulda_subject.stubs(:index_name).returns('my_index')
@shoulda_subject.stubs(:document_type).returns('my_document')
end
should "have the convenience index management methods" do
%w( create_index! delete_index! refresh_index! ).each do |method|
assert_respond_to subject, method
end
end
context "mappings" do
should "configure the mappings for the type" do
subject.mappings do
indexes :title
end
assert_equal( {:"my_document"=>{:properties=>{:title=>{:type=>"string"}}}}, subject.mappings.to_hash )
end
end
context "settings" do
should "configure the settings for the index" do
subject.settings foo: 'bar'
assert_equal( {foo: 'bar'}, subject.settings.to_hash)
end
end
end
end