Commit 3176444cbe2d0a2fc3d2753166b3d3998e954caa
1 parent
be886766
Exists in
master
and in
29 other branches
[pluginize-solr] Moving a test and defining default value for extra_index variable
Showing
3 changed files
with
7 additions
and
6 deletions
Show diff stats
plugins/solr/lib/ext/profile.rb
| ... | ... | @@ -41,6 +41,7 @@ class Profile |
| 41 | 41 | end |
| 42 | 42 | |
| 43 | 43 | def self.solr_plugin_extra_data_for_index(sym = nil, &block) |
| 44 | + self.solr_plugin_extra_index_methods ||= [] | |
| 44 | 45 | self.solr_plugin_extra_index_methods.push(sym) if sym |
| 45 | 46 | self.solr_plugin_extra_index_methods.push(block) if block_given? |
| 46 | 47 | end | ... | ... |
plugins/solr/test/unit/category_test.rb
| ... | ... | @@ -40,4 +40,10 @@ class CategoryTest < ActiveSupport::TestCase |
| 40 | 40 | c_name = Category.create!(:name => "science fiction", :environment_id => environment.id) |
| 41 | 41 | assert_equal [c_name, c_abbr], Category.find_by_contents("science")[:results].docs |
| 42 | 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 | 49 | end | ... | ... |
test/unit/category_test.rb
| ... | ... | @@ -513,10 +513,4 @@ class CategoryTest < ActiveSupport::TestCase |
| 513 | 513 | assert p.categories.reload.empty? |
| 514 | 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 | 516 | end | ... | ... |