@@ -49,7 +49,7 @@ class MyDocument; end
49
49
end
50
50
51
51
should "return whether document for document_type exists" do
52
- subject . expects ( :document_type ) . returns ( 'my_document' )
52
+ subject . expects ( :document_type ) . twice . returns ( 'my_document' )
53
53
54
54
@client
55
55
. expects ( :exists )
@@ -63,12 +63,12 @@ class MyDocument; end
63
63
assert_equal true , subject . exists? ( '1' )
64
64
end
65
65
66
- should "return whether document exists using _all type" do
66
+ should "return whether document exists using no document type" do
67
67
68
68
@client
69
69
. expects ( :exists )
70
70
. with do |arguments |
71
- assert_equal '_all' , arguments [ :type ]
71
+ assert_equal nil , arguments [ :type ]
72
72
assert_equal '1' , arguments [ :id ]
73
73
true
74
74
end
@@ -92,7 +92,7 @@ class MyDocument; end
92
92
context "'__find_one' method" do
93
93
94
94
should "find a document based on document_type and return a deserialized object" do
95
- subject . expects ( :document_type ) . returns ( 'my_document' )
95
+ subject . expects ( :document_type ) . twice . returns ( 'my_document' )
96
96
97
97
subject . expects ( :deserialize ) . with ( { '_source' => { 'foo' => 'bar' } } ) . returns ( MyDocument . new )
98
98
@@ -108,15 +108,15 @@ class MyDocument; end
108
108
assert_instance_of MyDocument , subject . __find_one ( '1' )
109
109
end
110
110
111
- should "find a document using _all if document_type is not defined" do
111
+ should "find a document using no type if document_type is not defined" do
112
112
subject . expects ( :document_type ) . returns ( nil )
113
113
114
114
subject . expects ( :deserialize ) . with ( { '_source' => { 'foo' => 'bar' } } ) . returns ( MyDocument . new )
115
115
116
116
@client
117
117
. expects ( :get )
118
118
. with do |arguments |
119
- assert_equal '_all' , arguments [ :type ]
119
+ assert_equal nil , arguments [ :type ]
120
120
assert_equal '1' , arguments [ :id ]
121
121
true
122
122
end
@@ -187,7 +187,7 @@ class MyDocument; end
187
187
end
188
188
189
189
should "find documents based on document_type and return an Array of deserialized objects" do
190
- subject . expects ( :document_type ) . returns ( 'my_document' )
190
+ subject . expects ( :document_type ) . twice . returns ( 'my_document' )
191
191
192
192
subject . expects ( :deserialize ) . twice
193
193
@@ -219,7 +219,7 @@ class MyDocument; end
219
219
@client
220
220
. expects ( :mget )
221
221
. with do |arguments |
222
- assert_equal '_all' , arguments [ :type ]
222
+ assert_equal nil , arguments [ :type ]
223
223
assert_equal [ '1' , '2' ] , arguments [ :body ] [ :ids ]
224
224
true
225
225
end
@@ -256,7 +256,7 @@ class MyDocument; end
256
256
"_source" => { "id" => "2" , "title" => "Test 2" } }
257
257
] }
258
258
259
- subject . expects ( :document_type ) . returns ( 'my_document' )
259
+ subject . expects ( :document_type ) . twice . returns ( 'my_document' )
260
260
261
261
subject
262
262
. expects ( :deserialize )
0 commit comments