lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject svn commit: r492698 - /incubator/solr/trunk/client/ruby/solrb/test/solr_mock_base.rb
Date Thu, 04 Jan 2007 19:18:26 GMT
Author: ehatcher
Date: Thu Jan  4 11:18:25 2007
New Revision: 492698

URL: http://svn.apache.org/viewvc?view=rev&rev=492698
Log:
add mock base class

Added:
    incubator/solr/trunk/client/ruby/solrb/test/solr_mock_base.rb   (with props)

Added: incubator/solr/trunk/client/ruby/solrb/test/solr_mock_base.rb
URL: http://svn.apache.org/viewvc/incubator/solr/trunk/client/ruby/solrb/test/solr_mock_base.rb?view=auto&rev=492698
==============================================================================
--- incubator/solr/trunk/client/ruby/solrb/test/solr_mock_base.rb (added)
+++ incubator/solr/trunk/client/ruby/solrb/test/solr_mock_base.rb Thu Jan  4 11:18:25 2007
@@ -0,0 +1,36 @@
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+require 'test/unit'
+require 'solr'
+
+class SolrMockBaseTestCase < Test::Unit::TestCase
+  include Solr
+  
+  def setup
+    Connection.send(:alias_method, :orig_post, :post)
+    Connection.class_eval %{
+      def post(request)
+        "foo"
+      end
+    }
+  end
+  
+  def teardown
+    Connection.send(:alias_method, :post, :orig_post)
+  end
+    
+  def test_mock
+    connection = Connection.new("http://localhost:9999")
+    assert_equal "foo", connection.post(UpdateRequest.new("bogus"))
+  end
+end

Propchange: incubator/solr/trunk/client/ruby/solrb/test/solr_mock_base.rb
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message