@@ -171,7 +171,7 @@ def self.before_save(&block)
171
171
( @callbacks ||= { } ) [ block . hash ] = block
172
172
end
173
173
174
- def changed_attributes ; [ :foo ] ; end
174
+ def attributes_in_database ; [ :foo ] ; end
175
175
176
176
def changes
177
177
{ :foo => [ 'One' , 'Two' ] }
@@ -186,7 +186,7 @@ def self.before_save(&block)
186
186
( @callbacks ||= { } ) [ block . hash ] = block
187
187
end
188
188
189
- def changed_attributes ; [ :foo , :bar ] ; end
189
+ def attributes_in_database ; [ :foo , :bar ] ; end
190
190
191
191
def changes
192
192
{ :foo => [ 'A' , 'B' ] , :bar => [ 'C' , 'D' ] }
@@ -202,10 +202,10 @@ def as_indexed_json(options={})
202
202
::DummyIndexingModelWithCallbacks . __send__ :include , Elasticsearch ::Model ::Indexing ::InstanceMethods
203
203
end
204
204
205
- should "set the @__changed_attributes variable before save" do
205
+ should "set the @__attributes_in_database variable before save" do
206
206
instance = ::DummyIndexingModelWithCallbacks . new
207
207
instance . expects ( :instance_variable_set ) . with do |name , value |
208
- assert_equal :@__changed_attributes , name
208
+ assert_equal :@__attributes_in_database , name
209
209
assert_equal ( { foo : 'Two' } , value )
210
210
true
211
211
end
@@ -297,7 +297,7 @@ def as_indexed_json(options={})
297
297
instance = ::DummyIndexingModelWithCallbacks . new
298
298
299
299
# Reset the fake `changes`
300
- instance . instance_variable_set ( :@__changed_attributes , nil )
300
+ instance . instance_variable_set ( :@__attributes_in_database , nil )
301
301
302
302
instance . expects ( :index_document )
303
303
instance . update_document
@@ -308,7 +308,7 @@ def as_indexed_json(options={})
308
308
instance = ::DummyIndexingModelWithCallbacks . new
309
309
310
310
# Set the fake `changes` hash
311
- instance . instance_variable_set ( :@__changed_attributes , { foo : 'bar' } )
311
+ instance . instance_variable_set ( :@__attributes_in_database , { foo : 'bar' } )
312
312
313
313
client . expects ( :update ) . with do |payload |
314
314
assert_equal 'foo' , payload [ :index ]
@@ -331,7 +331,7 @@ def as_indexed_json(options={})
331
331
instance = ::DummyIndexingModelWithCallbacksAndCustomAsIndexedJson . new
332
332
333
333
# Set the fake `changes` hash
334
- instance . instance_variable_set ( :@__changed_attributes , { 'foo' => 'B' , 'bar' => 'D' } )
334
+ instance . instance_variable_set ( :@__attributes_in_database , { 'foo' => 'B' , 'bar' => 'D' } )
335
335
336
336
client . expects ( :update ) . with do |payload |
337
337
assert_equal ( { :foo => 'B' } , payload [ :body ] [ :doc ] )
@@ -350,7 +350,7 @@ def as_indexed_json(options={})
350
350
client = mock ( 'client' )
351
351
instance = ::DummyIndexingModelWithCallbacksAndCustomAsIndexedJson . new
352
352
353
- instance . instance_variable_set ( :@__changed_attributes , { 'foo' => { 'bar' => 'BAR' } } )
353
+ instance . instance_variable_set ( :@__attributes_in_database , { 'foo' => { 'bar' => 'BAR' } } )
354
354
# Overload as_indexed_json
355
355
instance . expects ( :as_indexed_json ) . returns ( { 'foo' => 'BAR' } )
356
356
@@ -372,7 +372,7 @@ def as_indexed_json(options={})
372
372
instance = ::DummyIndexingModelWithCallbacks . new
373
373
374
374
# Set the fake `changes` hash
375
- instance . instance_variable_set ( :@__changed_attributes , { author : 'john' } )
375
+ instance . instance_variable_set ( :@__attributes_in_database , { author : 'john' } )
376
376
377
377
client . expects ( :update ) . with do |payload |
378
378
assert_equal 'foo' , payload [ :index ]
0 commit comments