Commit 78ad0c16bb492561c98f22fdb435aa064224ee4d
1 parent
e92e3963
Exists in
master
and in
29 other branches
Remove more solr stuff
Showing
2 changed files
with
0 additions
and
58 deletions
Show diff stats
test/test_helper.rb
| 1 | 1 | ENV["RAILS_ENV"] = "test" |
| 2 | 2 | |
| 3 | -# Start/stop Solr | |
| 4 | -if not $test_helper_loaded | |
| 5 | - abort unless system 'rake -s solr:start' | |
| 6 | - at_exit { system 'rake -s solr:stop' } | |
| 7 | - $test_helper_loaded = true | |
| 8 | -end | |
| 9 | - | |
| 10 | 3 | require File.expand_path(File.dirname(__FILE__) + "/../config/environment") |
| 11 | 4 | require 'test_help' |
| 12 | 5 | require 'mocha' |
| ... | ... | @@ -17,7 +10,6 @@ require 'noosfero/test' |
| 17 | 10 | require File.dirname(__FILE__) + '/factories' |
| 18 | 11 | require File.dirname(__FILE__) + '/noosfero_doc_test' |
| 19 | 12 | require File.dirname(__FILE__) + '/action_tracker_test_helper' |
| 20 | -require File.expand_path(File.dirname(__FILE__) + "/test_solr_helper.rb") | |
| 21 | 13 | |
| 22 | 14 | FileUtils.rm_rf(File.join(Rails.root, 'index', 'test')) |
| 23 | 15 | ... | ... |
test/test_solr_helper.rb
| ... | ... | @@ -1,50 +0,0 @@ |
| 1 | -class ActsAsSolr::Post | |
| 2 | - class << self | |
| 3 | - alias_method :execute_orig, :execute | |
| 4 | - end | |
| 5 | -end | |
| 6 | -module ActsAsSolr::ParserMethods | |
| 7 | - alias_method :parse_results_orig, :parse_results | |
| 8 | -end | |
| 9 | - | |
| 10 | -class TestSolr | |
| 11 | - | |
| 12 | - def self.enable | |
| 13 | - ActsAsSolr::Post.class_eval do | |
| 14 | - def self.execute(*args) | |
| 15 | - execute_orig *args | |
| 16 | - end | |
| 17 | - end | |
| 18 | - ActsAsSolr::ParserMethods.module_eval do | |
| 19 | - def parse_results(*args) | |
| 20 | - parse_results_orig *args | |
| 21 | - end | |
| 22 | - end | |
| 23 | - | |
| 24 | - # clear index | |
| 25 | - ActsAsSolr::Post.execute(Solr::Request::Delete.new(:query => '*:*')) | |
| 26 | - | |
| 27 | - @solr_disabled = false | |
| 28 | - end | |
| 29 | - | |
| 30 | - def self.disable | |
| 31 | - return if @solr_disabled | |
| 32 | - | |
| 33 | - ActsAsSolr::Post.class_eval do | |
| 34 | - def self.execute(*args) | |
| 35 | - true | |
| 36 | - end | |
| 37 | - end | |
| 38 | - ActsAsSolr::ParserMethods.module_eval do | |
| 39 | - def parse_results(*args) | |
| 40 | - parse_results_orig nil, args[1] | |
| 41 | - end | |
| 42 | - end | |
| 43 | - | |
| 44 | - @solr_disabled = true | |
| 45 | - end | |
| 46 | - | |
| 47 | -end | |
| 48 | - | |
| 49 | -# disable solr actions by default | |
| 50 | -TestSolr.disable |