summaryrefslogtreecommitdiff
path: root/spec/ruby/library/socket/option/inspect_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/socket/option/inspect_spec.rb')
-rw-r--r--spec/ruby/library/socket/option/inspect_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/ruby/library/socket/option/inspect_spec.rb b/spec/ruby/library/socket/option/inspect_spec.rb
new file mode 100644
index 0000000000..df72f227a9
--- /dev/null
+++ b/spec/ruby/library/socket/option/inspect_spec.rb
@@ -0,0 +1,20 @@
+require File.expand_path('../../../../spec_helper', __FILE__)
+require File.expand_path('../../fixtures/classes', __FILE__)
+
+require 'socket'
+
+describe 'Socket::Option#inspect' do
+ it 'correctly returns SO_LINGER value' do
+ value = Socket::Option.linger(nil, 0).inspect
+ value.should == '#<Socket::Option: UNSPEC SOCKET LINGER off 0sec>'
+
+ value = Socket::Option.linger(false, 30).inspect
+ value.should == '#<Socket::Option: UNSPEC SOCKET LINGER off 30sec>'
+
+ value = Socket::Option.linger(true, 0).inspect
+ value.should == '#<Socket::Option: UNSPEC SOCKET LINGER on 0sec>'
+
+ value = Socket::Option.linger(true, 30).inspect
+ value.should == '#<Socket::Option: UNSPEC SOCKET LINGER on 30sec>'
+ end
+end