diff options
Diffstat (limited to 'spec/ruby/library/socket/option')
| -rw-r--r-- | spec/ruby/library/socket/option/bool_spec.rb | 4 | ||||
| -rw-r--r-- | spec/ruby/library/socket/option/initialize_spec.rb | 30 | ||||
| -rw-r--r-- | spec/ruby/library/socket/option/int_spec.rb | 6 | ||||
| -rw-r--r-- | spec/ruby/library/socket/option/linger_spec.rb | 18 | ||||
| -rw-r--r-- | spec/ruby/library/socket/option/new_spec.rb | 6 |
5 files changed, 32 insertions, 32 deletions
diff --git a/spec/ruby/library/socket/option/bool_spec.rb b/spec/ruby/library/socket/option/bool_spec.rb index c4f8a277ba..9992e842b3 100644 --- a/spec/ruby/library/socket/option/bool_spec.rb +++ b/spec/ruby/library/socket/option/bool_spec.rb @@ -4,7 +4,7 @@ require_relative '../fixtures/classes' describe "Socket::Option.bool" do it "creates a new Socket::Option" do so = Socket::Option.bool(:INET, :SOCKET, :KEEPALIVE, true) - so.should be_an_instance_of(Socket::Option) + so.should.instance_of?(Socket::Option) so.family.should == Socket::AF_INET so.level.should == Socket::SOL_SOCKET so.optname.should == Socket::SO_KEEPALIVE @@ -21,7 +21,7 @@ describe "Socket::Option#bool" do platform_is_not :windows do it 'raises TypeError when called on a non boolean option' do opt = Socket::Option.linger(1, 4) - lambda { opt.bool }.should raise_error(TypeError) + -> { opt.bool }.should.raise(TypeError) end end end diff --git a/spec/ruby/library/socket/option/initialize_spec.rb b/spec/ruby/library/socket/option/initialize_spec.rb index 0d4621b71e..5af274f332 100644 --- a/spec/ruby/library/socket/option/initialize_spec.rb +++ b/spec/ruby/library/socket/option/initialize_spec.rb @@ -10,7 +10,7 @@ describe 'Socket::Option#initialize' do opt = Socket::Option .new(Socket::AF_INET, Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, @bool) - opt.should be_an_instance_of(Socket::Option) + opt.should.instance_of?(Socket::Option) opt.family.should == Socket::AF_INET opt.level.should == Socket::SOL_SOCKET @@ -23,7 +23,7 @@ describe 'Socket::Option#initialize' do it 'returns a Socket::Option' do opt = Socket::Option.new(:INET, :SOCKET, :KEEPALIVE, @bool) - opt.should be_an_instance_of(Socket::Option) + opt.should.instance_of?(Socket::Option) opt.family.should == Socket::AF_INET opt.level.should == Socket::SOL_SOCKET @@ -32,21 +32,21 @@ describe 'Socket::Option#initialize' do end it 'raises when using an invalid address family' do - lambda { + -> { Socket::Option.new(:INET2, :SOCKET, :KEEPALIVE, @bool) - }.should raise_error(SocketError) + }.should.raise(SocketError) end it 'raises when using an invalid level' do - lambda { + -> { Socket::Option.new(:INET, :CATS, :KEEPALIVE, @bool) - }.should raise_error(SocketError) + }.should.raise(SocketError) end it 'raises when using an invalid option name' do - lambda { + -> { Socket::Option.new(:INET, :SOCKET, :CATS, @bool) - }.should raise_error(SocketError) + }.should.raise(SocketError) end end @@ -54,7 +54,7 @@ describe 'Socket::Option#initialize' do it 'returns a Socket::Option' do opt = Socket::Option.new('INET', 'SOCKET', 'KEEPALIVE', @bool) - opt.should be_an_instance_of(Socket::Option) + opt.should.instance_of?(Socket::Option) opt.family.should == Socket::AF_INET opt.level.should == Socket::SOL_SOCKET @@ -63,21 +63,21 @@ describe 'Socket::Option#initialize' do end it 'raises when using an invalid address family' do - lambda { + -> { Socket::Option.new('INET2', 'SOCKET', 'KEEPALIVE', @bool) - }.should raise_error(SocketError) + }.should.raise(SocketError) end it 'raises when using an invalid level' do - lambda { + -> { Socket::Option.new('INET', 'CATS', 'KEEPALIVE', @bool) - }.should raise_error(SocketError) + }.should.raise(SocketError) end it 'raises when using an invalid option name' do - lambda { + -> { Socket::Option.new('INET', 'SOCKET', 'CATS', @bool) - }.should raise_error(SocketError) + }.should.raise(SocketError) end end end diff --git a/spec/ruby/library/socket/option/int_spec.rb b/spec/ruby/library/socket/option/int_spec.rb index 5c67ec26d8..0cd341f88a 100644 --- a/spec/ruby/library/socket/option/int_spec.rb +++ b/spec/ruby/library/socket/option/int_spec.rb @@ -4,7 +4,7 @@ require_relative '../fixtures/classes' describe "Socket::Option.int" do it "creates a new Socket::Option" do so = Socket::Option.int(:INET, :SOCKET, :KEEPALIVE, 5) - so.should be_an_instance_of(Socket::Option) + so.should.instance_of?(Socket::Option) so.family.should == Socket::Constants::AF_INET so.level.should == Socket::Constants::SOL_SOCKET so.optname.should == Socket::Constants::SO_KEEPALIVE @@ -14,7 +14,7 @@ describe "Socket::Option.int" do it 'returns a Socket::Option' do opt = Socket::Option.int(:INET, :IP, :TTL, 4) - opt.should be_an_instance_of(Socket::Option) + opt.should.instance_of?(Socket::Option) opt.family.should == Socket::AF_INET opt.level.should == Socket::IPPROTO_IP @@ -37,7 +37,7 @@ describe "Socket::Option#int" do platform_is_not :windows do it 'raises TypeError when called on a non integer option' do opt = Socket::Option.linger(1, 4) - lambda { opt.int }.should raise_error(TypeError) + -> { opt.int }.should.raise(TypeError) end end end diff --git a/spec/ruby/library/socket/option/linger_spec.rb b/spec/ruby/library/socket/option/linger_spec.rb index 94467ebf71..87c5e0982e 100644 --- a/spec/ruby/library/socket/option/linger_spec.rb +++ b/spec/ruby/library/socket/option/linger_spec.rb @@ -9,7 +9,7 @@ end describe "Socket::Option.linger" do it "creates a new Socket::Option for SO_LINGER" do so = Socket::Option.linger(1, 10) - so.should be_an_instance_of(Socket::Option) + so.should.instance_of?(Socket::Option) so.family.should == Socket::Constants::AF_UNSPEC so.level.should == Socket::Constants::SOL_SOCKET @@ -31,46 +31,46 @@ describe "Socket::Option#linger" do it "returns linger option" do so = Socket::Option.linger(0, 5) ary = so.linger - ary[0].should be_false + ary[0].should == false ary[1].should == 5 so = Socket::Option.linger(false, 4) ary = so.linger - ary[0].should be_false + ary[0].should == false ary[1].should == 4 so = Socket::Option.linger(1, 10) ary = so.linger - ary[0].should be_true + ary[0].should == true ary[1].should == 10 so = Socket::Option.linger(true, 9) ary = so.linger - ary[0].should be_true + ary[0].should == true ary[1].should == 9 end it "raises TypeError if not a SO_LINGER" do so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :KEEPALIVE, 1) - lambda { so.linger }.should raise_error(TypeError) + -> { so.linger }.should.raise(TypeError) end it 'raises TypeError when called on a non SOL_SOCKET/SO_LINGER option' do opt = Socket::Option.int(:INET, :IP, :TTL, 4) - lambda { opt.linger }.should raise_error(TypeError) + -> { opt.linger }.should.raise(TypeError) end platform_is_not :windows do it "raises TypeError if option has not good size" do so = Socket::Option.int(:AF_UNSPEC, :SOL_SOCKET, :LINGER, 1) - lambda { so.linger }.should raise_error(TypeError) + -> { so.linger }.should.raise(TypeError) end end it 'raises TypeError when called on a non linger option' do opt = Socket::Option.new(:INET, :SOCKET, :LINGER, '') - lambda { opt.linger }.should raise_error(TypeError) + -> { opt.linger }.should.raise(TypeError) end end diff --git a/spec/ruby/library/socket/option/new_spec.rb b/spec/ruby/library/socket/option/new_spec.rb index f3b7b31c91..3721d63ee5 100644 --- a/spec/ruby/library/socket/option/new_spec.rb +++ b/spec/ruby/library/socket/option/new_spec.rb @@ -22,14 +22,14 @@ describe "Socket::Option.new" do end it "should raise error on unknown family" do - lambda { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError) + -> { Socket::Option.new(:INET4, :SOCKET, :KEEPALIVE, [0].pack('i')) }.should.raise(SocketError) end it "should raise error on unknown level" do - lambda { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should raise_error(SocketError) + -> { Socket::Option.new(:INET, :ROCKET, :KEEPALIVE, [0].pack('i')) }.should.raise(SocketError) end it "should raise error on unknown option name" do - lambda { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should raise_error(SocketError) + -> { Socket::Option.new(:INET, :SOCKET, :ALIVE, [0].pack('i')) }.should.raise(SocketError) end end |
