diff options
Diffstat (limited to 'spec/ruby/library/ipaddr')
| -rw-r--r-- | spec/ruby/library/ipaddr/ipv4_conversion_spec.rb | 8 | ||||
| -rw-r--r-- | spec/ruby/library/ipaddr/new_spec.rb | 17 | ||||
| -rw-r--r-- | spec/ruby/library/ipaddr/operator_spec.rb | 16 | ||||
| -rw-r--r-- | spec/ruby/library/ipaddr/reverse_spec.rb | 4 |
4 files changed, 22 insertions, 23 deletions
diff --git a/spec/ruby/library/ipaddr/ipv4_conversion_spec.rb b/spec/ruby/library/ipaddr/ipv4_conversion_spec.rb index 9d45055d76..1128c16dd2 100644 --- a/spec/ruby/library/ipaddr/ipv4_conversion_spec.rb +++ b/spec/ruby/library/ipaddr/ipv4_conversion_spec.rb @@ -8,11 +8,11 @@ describe "IPAddr#ipv4_compat" do a.to_s.should == "::192.168.1.2" a.to_string.should == "0000:0000:0000:0000:0000:0000:c0a8:0102" a.family.should == Socket::AF_INET6 - a.ipv4_compat?.should == true + a.should.ipv4_compat? b = a.native b.to_s.should == "192.168.1.2" b.family.should == Socket::AF_INET - b.ipv4_compat?.should == false + b.should_not.ipv4_compat? a = IPAddr.new("192.168.1.2") b = a.ipv4_compat @@ -29,11 +29,11 @@ describe "IPAddr#ipv4_mapped" do a.to_s.should == "::ffff:192.168.1.2" a.to_string.should == "0000:0000:0000:0000:0000:ffff:c0a8:0102" a.family.should == Socket::AF_INET6 - a.ipv4_mapped?.should == true + a.should.ipv4_mapped? b = a.native b.to_s.should == "192.168.1.2" b.family.should == Socket::AF_INET - b.ipv4_mapped?.should == false + b.should_not.ipv4_mapped? a = IPAddr.new("192.168.1.2") b = a.ipv4_mapped diff --git a/spec/ruby/library/ipaddr/new_spec.rb b/spec/ruby/library/ipaddr/new_spec.rb index c8c8bc80b3..7fba2b372e 100644 --- a/spec/ruby/library/ipaddr/new_spec.rb +++ b/spec/ruby/library/ipaddr/new_spec.rb @@ -3,9 +3,9 @@ require 'ipaddr' describe "IPAddr#new" do it "initializes IPAddr" do - ->{ IPAddr.new("3FFE:505:ffff::/48") }.should_not raise_error - ->{ IPAddr.new("0:0:0:1::") }.should_not raise_error - ->{ IPAddr.new("2001:200:300::/48") }.should_not raise_error + ->{ IPAddr.new("3FFE:505:ffff::/48") }.should_not.raise + ->{ IPAddr.new("0:0:0:1::") }.should_not.raise + ->{ IPAddr.new("2001:200:300::/48") }.should_not.raise end it "initializes IPAddr ipv6 address with short notation" do @@ -27,8 +27,8 @@ describe "IPAddr#new" do a.to_s.should == "3ffe:505:2::" a.to_string.should == "3ffe:0505:0002:0000:0000:0000:0000:0000" a.family.should == Socket::AF_INET6 - a.ipv4?.should == false - a.ipv6?.should == true + a.should_not.ipv4? + a.should.ipv6? a.inspect.should == "#<IPAddr: IPv6:3ffe:0505:0002:0000:0000:0000:0000:0000/ffff:ffff:ffff:0000:0000:0000:0000:0000>" end @@ -51,8 +51,8 @@ describe "IPAddr#new" do a.to_s.should == "192.168.1.2" a.to_string.should == "192.168.1.2" a.family.should == Socket::AF_INET - a.ipv4?.should == true - a.ipv6?.should == false + a.should.ipv4? + a.should_not.ipv6? end it "initializes IPAddr ipv4 address with / subnet notation" do @@ -79,7 +79,6 @@ describe "IPAddr#new" do it "raises on incorrect IPAddr strings" do [ - ["fe80::1%fxp0"], ["::1/255.255.255.0"], [IPAddr.new("::1").to_i], ["::ffff:192.168.1.2/120", Socket::AF_INET], @@ -87,7 +86,7 @@ describe "IPAddr#new" do ].each { |args| ->{ IPAddr.new(*args) - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) } end end diff --git a/spec/ruby/library/ipaddr/operator_spec.rb b/spec/ruby/library/ipaddr/operator_spec.rb index f90c56009c..3337d22300 100644 --- a/spec/ruby/library/ipaddr/operator_spec.rb +++ b/spec/ruby/library/ipaddr/operator_spec.rb @@ -66,17 +66,17 @@ describe "IPAddr Operator" do end it "checks whether an address is included in a range" do - @a.should include(IPAddr.new("3ffe:505:2::")) - @a.should include(IPAddr.new("3ffe:505:2::1")) - @a.should_not include(IPAddr.new("3ffe:505:3::")) + @a.should.include?(IPAddr.new("3ffe:505:2::")) + @a.should.include?(IPAddr.new("3ffe:505:2::1")) + @a.should_not.include?(IPAddr.new("3ffe:505:3::")) net1 = IPAddr.new("192.168.2.0/24") - net1.should include(IPAddr.new("192.168.2.0")) - net1.should include(IPAddr.new("192.168.2.255")) - net1.should_not include(IPAddr.new("192.168.3.0")) + net1.should.include?(IPAddr.new("192.168.2.0")) + net1.should.include?(IPAddr.new("192.168.2.255")) + net1.should_not.include?(IPAddr.new("192.168.3.0")) # test with integer parameter int = (192 << 24) + (168 << 16) + (2 << 8) + 13 - net1.should include(int) - net1.should_not include(int+255) + net1.should.include?(int) + net1.should_not.include?(int+255) end end diff --git a/spec/ruby/library/ipaddr/reverse_spec.rb b/spec/ruby/library/ipaddr/reverse_spec.rb index 6ebb343269..9bda60ca70 100644 --- a/spec/ruby/library/ipaddr/reverse_spec.rb +++ b/spec/ruby/library/ipaddr/reverse_spec.rb @@ -13,7 +13,7 @@ describe "IPAddr#ip6_arpa" do IPAddr.new("3ffe:505:2::f").ip6_arpa.should == "f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.arpa" ->{ IPAddr.new("192.168.2.1").ip6_arpa - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end @@ -22,6 +22,6 @@ describe "IPAddr#ip6_int" do IPAddr.new("3ffe:505:2::f").ip6_int.should == "f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.int" ->{ IPAddr.new("192.168.2.1").ip6_int - }.should raise_error(ArgumentError) + }.should.raise(ArgumentError) end end |
