spec/supernova/solr_indexer_spec.rb in supernova-0.3.6 vs spec/supernova/solr_indexer_spec.rb in supernova-0.3.8
- old
+ new
@@ -404,9 +404,25 @@
indexer.should_receive(:defined_fields).and_return [defined]
indexer.select_fields.should == [default, defined]
end
end
+ describe "SolrIndexer.select_fields" do
+ it "returns the keys of the field definitions" do
+ Supernova::SolrIndexer.should_receive(:field_definitions).and_return(
+ { :title => { :type => :string }, :popularity => { :type => :integer } }
+ )
+ Supernova::SolrIndexer.select_fields.map(&:to_s).sort.should == %w(popularity title)
+ end
+
+ it "does not include virtual attributes" do
+ Supernova::SolrIndexer.should_receive(:field_definitions).and_return(
+ { :title => { :type => :string }, :popularity => { :type => :integer }, :is_deleted => { :virtual => true, :type => :integer } }
+ )
+ Supernova::SolrIndexer.select_fields.map(&:to_s).sort.should == %w(popularity title)
+ end
+ end
+
describe "#method_missing" do
it "returns a new supernova criteria" do
indexer_clazz.where(:a => 1).should be_an_instance_of(Supernova::SolrCriteria)
end