Commit 3176444cbe2d0a2fc3d2753166b3d3998e954caa

Authored by Rodrigo Souto
1 parent be886766

[pluginize-solr] Moving a test and defining default value for extra_index variable

plugins/solr/lib/ext/profile.rb
@@ -41,6 +41,7 @@ class Profile @@ -41,6 +41,7 @@ class Profile
41 end 41 end
42 42
43 def self.solr_plugin_extra_data_for_index(sym = nil, &block) 43 def self.solr_plugin_extra_data_for_index(sym = nil, &block)
  44 + self.solr_plugin_extra_index_methods ||= []
44 self.solr_plugin_extra_index_methods.push(sym) if sym 45 self.solr_plugin_extra_index_methods.push(sym) if sym
45 self.solr_plugin_extra_index_methods.push(block) if block_given? 46 self.solr_plugin_extra_index_methods.push(block) if block_given?
46 end 47 end
plugins/solr/test/unit/category_test.rb
@@ -40,4 +40,10 @@ class CategoryTest < ActiveSupport::TestCase @@ -40,4 +40,10 @@ class CategoryTest < ActiveSupport::TestCase
40 c_name = Category.create!(:name => "science fiction", :environment_id => environment.id) 40 c_name = Category.create!(:name => "science fiction", :environment_id => environment.id)
41 assert_equal [c_name, c_abbr], Category.find_by_contents("science")[:results].docs 41 assert_equal [c_name, c_abbr], Category.find_by_contents("science")[:results].docs
42 end 42 end
  43 +
  44 + should 'solr save' do
  45 + c = environment.categories.build(:name => 'my category');
  46 + c.expects(:solr_save)
  47 + c.save!
  48 + end
43 end 49 end
test/unit/category_test.rb
@@ -513,10 +513,4 @@ class CategoryTest < ActiveSupport::TestCase @@ -513,10 +513,4 @@ class CategoryTest < ActiveSupport::TestCase
513 assert p.categories.reload.empty? 513 assert p.categories.reload.empty?
514 end 514 end
515 515
516 - should 'solr save' do  
517 - c = @env.categories.build(:name => 'my category');  
518 - c.expects(:solr_save)  
519 - c.save!  
520 - end  
521 -  
522 end 516 end