spec/integration/riak/http_backends_spec.rb in riak-client-0.9.8 vs spec/integration/riak/http_backends_spec.rb in riak-client-1.0.0.beta

- old
+ new

@@ -1,38 +1,14 @@ -# Copyright 2010 Sean Cribbs and Basho Technologies, Inc. -# -# Licensed 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 File.expand_path("../../spec_helper", File.dirname(__FILE__)) +require 'spec_helper' describe "HTTP" do - before :all do - if $test_server - @web_port = 9000 - $test_server.start - end - end - before do - @web_port ||= 8098 + @web_port = $test_server.http_port @client = Riak::Client.new(:http_port => @web_port) end - after do - $test_server.recycle if $test_server.started? - end - - [:CurbBackend, :ExconBackend, :NetHTTPBackend].each do |klass| + [:ExconBackend, :NetHTTPBackend].each do |klass| bklass = Riak::Client.const_get(klass) if bklass.configured? describe klass.to_s do before do @backend = bklass.new(@client) @@ -61,11 +37,11 @@ subject { Riak::Client::NetHTTPBackend.new(@client) } let(:file) { File.open(__FILE__) } let(:sized) { Reader.new(["foo", "bar", "baz"]) } let(:sizeless) { SizelessReader.new(["foo", "bar", "baz"]) } it "should set the content-length or transfer-encoding properly on IO uploads" do - lambda { subject.put(204, "/riak/nethttp", "test-file", file, {"Content-Type" => "text/plain"}) }.should_not raise_error - lambda { subject.put(204, "/riak/nethttp", "test-sized", sized, {"Content-Type" => "text/plain"}) }.should_not raise_error - lambda { subject.put(204, "/riak/nethttp", "test-file", sizeless, {"Content-Type" => "text/plain"}) }.should_not raise_error + lambda { subject.put(204, subject.object_path('nethttp', 'test-file'), file, {"Content-Type" => "text/plain"}) }.should_not raise_error + lambda { subject.put(204, subject.object_path('nethttp', 'test-sized'), sized, {"Content-Type" => "text/plain"}) }.should_not raise_error + lambda { subject.put(204, subject.object_path('nethttp', 'test-sizeless'), sizeless, {"Content-Type" => "text/plain"}) }.should_not raise_error end end end