Thrift-1644:Upgrade RSpec to 2.11.x and refactor specs as needed
Client: rb
Patch: Nathan Beyer
Upgrading to rspec2.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1391280 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/rb/spec/socket_spec.rb b/lib/rb/spec/socket_spec.rb
index d5ae6b0..ef8a0a1 100644
--- a/lib/rb/spec/socket_spec.rb
+++ b/lib/rb/spec/socket_spec.rb
@@ -17,15 +17,14 @@
# under the License.
#
-require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
+require 'spec_helper'
require File.expand_path("#{File.dirname(__FILE__)}/socket_spec_shared")
-class ThriftSocketSpec < Spec::ExampleGroup
- include Thrift
+describe 'Socket' do
- describe Socket do
+ describe Thrift::Socket do
before(:each) do
- @socket = Socket.new
+ @socket = Thrift::Socket.new
@handle = mock("Handle", :closed? => false)
@handle.stub!(:close)
@handle.stub!(:connect_nonblock)
@@ -50,12 +49,12 @@
::Socket.should_receive(:new).and_return(mock("Handle", :connect_nonblock => true))
::Socket.should_receive(:getaddrinfo).with("my.domain", 1234, nil, ::Socket::SOCK_STREAM).and_return([[]])
::Socket.should_receive(:sockaddr_in)
- Socket.new('my.domain', 1234).open
+ Thrift::Socket.new('my.domain', 1234).open
end
it "should accept an optional timeout" do
::Socket.stub!(:new)
- Socket.new('localhost', 8080, 5).timeout.should == 5
+ Thrift::Socket.new('localhost', 8080, 5).timeout.should == 5
end
end
end