Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

failing tests

  • Loading branch information...
commit ffc70bb7058d310ae677579c2b7ace4a983284c2 1 parent 1d6b267
@sandrew sandrew authored
View
24 test/integration/active_record_searchable_test.rb
@@ -32,6 +32,10 @@ def setup
create_table :active_record_class_with_dynamic_index_names do |t|
t.string :title
end
+ create_table :sti_ancestors do |t|
+ t.string :title
+ t.string :type
+ end
end
end
@@ -352,6 +356,26 @@ module ::Rails; end
end
+ context 'with Single Table Inheritance' do
+ setup do
+ StiAncestor.create! :title => 'Ancestor text'
+ FirstStiDescendant.create! :title => 'Descendant text'
+ SecondStiDescendant.create! :title => 'Another Descendant text'
+ end
+
+ should 'load all STI descendants items' do
+ res = Tire.search('sti_ancestors', :load => true) do
+ query do
+ string 'Descendant'
+ end
+ end.results.results
+
+ assert_length_of res.results, 2
+ assert_instance_of FirstStiDescendant, res[0]
+ assert_instance_of SecondStiDescendant, res[1]
+ end
+ end
+
end
end
View
13 test/models/active_record_models.rb
@@ -78,3 +78,16 @@ class ActiveRecordClassWithDynamicIndexName < ActiveRecord::Base
"dynamic" + '_' + "index"
end
end
+
+class StiAncestor < ActiveRecord::Base
+ include Tire::Model::Search
+ include Tire::Model::Callbacks
+end
+
+class FirstStiDescendant < StiAncestor
+ index_name 'sti_ancestors'
+end
+
+class SecondStiDescendant < StiAncestor
+ index_name 'sti_ancestors'
+end
Please sign in to comment.
Something went wrong with that request. Please try again.