@@ -221,7 +221,7 @@ def self.table_name_prefix
221
221
class Namespaced ::Model < ActiveRecord ::Base
222
222
include AlgoliaSearch
223
223
224
- algoliasearch :synchronous => true do
224
+ algoliasearch :synchronous => true , :index_name => safe_index_name ( algolia_index_name ( { } ) ) do
225
225
attribute :customAttr do
226
226
40 + another_private_value
227
227
end
@@ -637,23 +637,25 @@ class SerializedObject < ActiveRecord::Base
637
637
end
638
638
639
639
it "should have an index name without :: hierarchy" do
640
- Namespaced ::Model . index_name . should == "Namespaced_Model"
640
+ ( Namespaced ::Model . index_name . end_with? ( "Namespaced_Model" ) ) . should == true
641
641
end
642
642
643
643
it "should use the block to determine attribute's value" do
644
- m = Namespaced ::Model . new ( another_private_value : 2 )
644
+ m = Namespaced ::Model . new ( :another_private_value => 2 )
645
645
attributes = Namespaced ::Model . algoliasearch_settings . get_attributes ( m )
646
646
attributes [ 'customAttr' ] . should == 42
647
647
attributes [ 'myid' ] . should == m . id
648
648
end
649
649
650
650
it "should always update when there is no custom _changed? function" do
651
- m = Namespaced ::Model . create! ( another_private_value : 2 )
651
+ m = Namespaced ::Model . new ( :another_private_value => 2 )
652
+ m . save
652
653
results = Namespaced ::Model . search ( 42 )
653
654
expect ( results . size ) . to eq ( 1 )
654
655
expect ( results [ 0 ] . id ) . to eq ( m . id )
655
656
656
- m . update! ( another_private_value : 5 )
657
+ m . another_private_value = 5
658
+ m . save
657
659
658
660
results = Namespaced ::Model . search ( 42 )
659
661
expect ( results . size ) . to eq ( 0 )
0 commit comments