From 3176444cbe2d0a2fc3d2753166b3d3998e954caa Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Thu, 13 Dec 2012 18:25:57 +0000 Subject: [PATCH] [pluginize-solr] Moving a test and defining default value for extra_index variable --- plugins/solr/lib/ext/profile.rb | 1 + plugins/solr/test/unit/category_test.rb | 6 ++++++ test/unit/category_test.rb | 6 ------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/solr/lib/ext/profile.rb b/plugins/solr/lib/ext/profile.rb index 104b2b8..96ebb2a 100644 --- a/plugins/solr/lib/ext/profile.rb +++ b/plugins/solr/lib/ext/profile.rb @@ -41,6 +41,7 @@ class Profile end def self.solr_plugin_extra_data_for_index(sym = nil, &block) + self.solr_plugin_extra_index_methods ||= [] self.solr_plugin_extra_index_methods.push(sym) if sym self.solr_plugin_extra_index_methods.push(block) if block_given? end diff --git a/plugins/solr/test/unit/category_test.rb b/plugins/solr/test/unit/category_test.rb index 4be9a7b..56f903d 100644 --- a/plugins/solr/test/unit/category_test.rb +++ b/plugins/solr/test/unit/category_test.rb @@ -40,4 +40,10 @@ class CategoryTest < ActiveSupport::TestCase c_name = Category.create!(:name => "science fiction", :environment_id => environment.id) assert_equal [c_name, c_abbr], Category.find_by_contents("science")[:results].docs end + + should 'solr save' do + c = environment.categories.build(:name => 'my category'); + c.expects(:solr_save) + c.save! + end end diff --git a/test/unit/category_test.rb b/test/unit/category_test.rb index 2982acb..24eb237 100644 --- a/test/unit/category_test.rb +++ b/test/unit/category_test.rb @@ -513,10 +513,4 @@ class CategoryTest < ActiveSupport::TestCase assert p.categories.reload.empty? end - should 'solr save' do - c = @env.categories.build(:name => 'my category'); - c.expects(:solr_save) - c.save! - end - end -- libgit2 0.21.2