Skip to content

Apache Lucene open-source search software

refactor the solr mock a bit more

Erik Hatcher9da08c70d726
diff --git a/client/ruby/solrb/Rakefile b/client/ruby/solrb/Rakefile
index 7954779f569..b6ec03a342a 100644
--- a/client/ruby/solrb/Rakefile
+++ b/client/ruby/solrb/Rakefile
@@ -45,7 +45,7 @@ end
Rake::TestTask.new('test') do |t|
t.pattern = 'test/*_test.rb'
t.verbose = true
- t.ruby_opts = ['-r solr', '-r test/unit']
+ t.ruby_opts = ['-r solr', '-r test/unit', '-Itest']
end
task :test do
diff --git a/client/ruby/solrb/test/connection_test.rb b/client/ruby/solrb/test/connection_test.rb
index 9420911a55e..04d2b57fb3a 100755
--- a/client/ruby/solrb/test/connection_test.rb
+++ b/client/ruby/solrb/test/connection_test.rb
@@ -12,23 +12,9 @@
require 'test/unit'
require 'solr'
+require 'solr_mock_base'
-module Solr
- class Connection
- def post(request)
- "foo"
- end
- end
-
- class MockSolrBaseTest < Test::Unit::TestCase
- def test_mock
- connection = Connection.new("http://localhost:9999")
- assert_equal "foo", connection.post(UpdateRequest.new("bogus"))
- end
- end
-end
-
-class ConnectionTest < Solr::MockSolrBaseTest
+class ConnectionTest < SolrMockBaseTestCase
def test_connection_initialize
request = Solr::UpdateRequest.new("<commit/>")
connection = Solr::Connection.new("http://localhost:8983")
diff --git a/client/ruby/solrb/test/test_helper.rb b/client/ruby/solrb/test/test_helper.rb
index e6912b362c8..f13e0265939 100644
--- a/client/ruby/solrb/test/test_helper.rb
+++ b/client/ruby/solrb/test/test_helper.rb
@@ -10,8 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'test/unit'
-
def start_solr_server
Dir.chdir(File.dirname(__FILE__) + '/../solr') do
puts "starting solr server"