Skip to content

Commit c1e28a2

Browse files
committed
Fix spec for old ruby
1 parent da30909 commit c1e28a2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

spec/integration_spec.rb

+7-5
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def self.table_name_prefix
221221
class Namespaced::Model < ActiveRecord::Base
222222
include AlgoliaSearch
223223

224-
algoliasearch :synchronous => true do
224+
algoliasearch :synchronous => true, :index_name => safe_index_name(algolia_index_name({})) do
225225
attribute :customAttr do
226226
40 + another_private_value
227227
end
@@ -637,23 +637,25 @@ class SerializedObject < ActiveRecord::Base
637637
end
638638

639639
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
641641
end
642642

643643
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)
645645
attributes = Namespaced::Model.algoliasearch_settings.get_attributes(m)
646646
attributes['customAttr'].should == 42
647647
attributes['myid'].should == m.id
648648
end
649649

650650
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
652653
results = Namespaced::Model.search(42)
653654
expect(results.size).to eq(1)
654655
expect(results[0].id).to eq(m.id)
655656

656-
m.update!(another_private_value: 5)
657+
m.another_private_value = 5
658+
m.save
657659

658660
results = Namespaced::Model.search(42)
659661
expect(results.size).to eq(0)

0 commit comments

Comments
 (0)