summaryrefslogtreecommitdiff
path: root/spec/ruby/library/etc
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/library/etc')
-rw-r--r--spec/ruby/library/etc/confstr_spec.rb6
-rw-r--r--spec/ruby/library/etc/getgrgid_spec.rb8
-rw-r--r--spec/ruby/library/etc/getgrnam_spec.rb2
-rw-r--r--spec/ruby/library/etc/getlogin_spec.rb4
-rw-r--r--spec/ruby/library/etc/getpwnam_spec.rb2
-rw-r--r--spec/ruby/library/etc/getpwuid_spec.rb2
-rw-r--r--spec/ruby/library/etc/group_spec.rb4
-rw-r--r--spec/ruby/library/etc/nprocessors_spec.rb2
-rw-r--r--spec/ruby/library/etc/passwd_spec.rb4
-rw-r--r--spec/ruby/library/etc/sysconf_spec.rb4
-rw-r--r--spec/ruby/library/etc/sysconfdir_spec.rb4
-rw-r--r--spec/ruby/library/etc/systmpdir_spec.rb4
-rw-r--r--spec/ruby/library/etc/uname_spec.rb14
13 files changed, 37 insertions, 23 deletions
diff --git a/spec/ruby/library/etc/confstr_spec.rb b/spec/ruby/library/etc/confstr_spec.rb
index 41a970a918..786cb16407 100644
--- a/spec/ruby/library/etc/confstr_spec.rb
+++ b/spec/ruby/library/etc/confstr_spec.rb
@@ -1,14 +1,14 @@
-require File.expand_path('../../../spec_helper', __FILE__)
+require_relative '../../spec_helper'
require 'etc'
platform_is_not :windows, :android do
describe "Etc.confstr" do
it "returns a String for Etc::CS_PATH" do
- Etc.confstr(Etc::CS_PATH).should be_an_instance_of(String)
+ Etc.confstr(Etc::CS_PATH).should.instance_of?(String)
end
it "raises Errno::EINVAL for unknown configuration variables" do
- -> { Etc.confstr(-1) }.should raise_error(Errno::EINVAL)
+ -> { Etc.confstr(-1) }.should.raise(Errno::EINVAL)
end
end
end
diff --git a/spec/ruby/library/etc/getgrgid_spec.rb b/spec/ruby/library/etc/getgrgid_spec.rb
index 14da5e041d..472d4c82c8 100644
--- a/spec/ruby/library/etc/getgrgid_spec.rb
+++ b/spec/ruby/library/etc/getgrgid_spec.rb
@@ -34,7 +34,7 @@ platform_is_not :windows do
it "returns the Etc::Group for a given gid if it exists" do
grp = Etc.getgrgid(@gid)
- grp.should be_kind_of(Etc::Group)
+ grp.should.is_a?(Etc::Group)
grp.gid.should == @gid
grp.name.should == @name
end
@@ -47,12 +47,12 @@ platform_is_not :windows do
end
it "raises if the group does not exist" do
- -> { Etc.getgrgid(9876)}.should raise_error(ArgumentError)
+ -> { Etc.getgrgid(9876)}.should.raise(ArgumentError)
end
it "raises a TypeError if not passed an Integer" do
- -> { Etc.getgrgid("foo") }.should raise_error(TypeError)
- -> { Etc.getgrgid(nil) }.should raise_error(TypeError)
+ -> { Etc.getgrgid("foo") }.should.raise(TypeError)
+ -> { Etc.getgrgid(nil) }.should.raise(TypeError)
end
it "can be called safely by multiple threads" do
diff --git a/spec/ruby/library/etc/getgrnam_spec.rb b/spec/ruby/library/etc/getgrnam_spec.rb
index fa49f15349..325ea7b297 100644
--- a/spec/ruby/library/etc/getgrnam_spec.rb
+++ b/spec/ruby/library/etc/getgrnam_spec.rb
@@ -24,7 +24,7 @@ platform_is_not :windows, :android do
-> {
Etc.getgrnam(123)
Etc.getgrnam(nil)
- }.should raise_error(TypeError)
+ }.should.raise(TypeError)
end
end
end
diff --git a/spec/ruby/library/etc/getlogin_spec.rb b/spec/ruby/library/etc/getlogin_spec.rb
index 7a4fd79ae2..2bc598c0af 100644
--- a/spec/ruby/library/etc/getlogin_spec.rb
+++ b/spec/ruby/library/etc/getlogin_spec.rb
@@ -14,7 +14,7 @@ describe "Etc.getlogin" do
if ENV['TRAVIS'] and platform_is(:darwin)
# See https://travis-ci.org/ruby/spec/jobs/285967744
# and https://travis-ci.org/ruby/spec/jobs/285999602
- Etc.getlogin.should be_an_instance_of(String)
+ Etc.getlogin.should.instance_of?(String)
else
# Etc.getlogin returns the same result of logname(2)
# if it returns non NULL
@@ -28,7 +28,7 @@ describe "Etc.getlogin" do
else
# Etc.getlogin may return nil if the login name is not set
# because of chroot or sudo or something.
- Etc.getlogin.should be_nil
+ Etc.getlogin.should == nil
getlogin_null = true
end
ensure
diff --git a/spec/ruby/library/etc/getpwnam_spec.rb b/spec/ruby/library/etc/getpwnam_spec.rb
index 3f4416aa9d..a0b3c9e1fe 100644
--- a/spec/ruby/library/etc/getpwnam_spec.rb
+++ b/spec/ruby/library/etc/getpwnam_spec.rb
@@ -22,7 +22,7 @@ platform_is_not :windows do
-> {
Etc.getpwnam(123)
Etc.getpwnam(nil)
- }.should raise_error(TypeError)
+ }.should.raise(TypeError)
end
end
end
diff --git a/spec/ruby/library/etc/getpwuid_spec.rb b/spec/ruby/library/etc/getpwuid_spec.rb
index 5b98f0f8d9..3e35dfe6d5 100644
--- a/spec/ruby/library/etc/getpwuid_spec.rb
+++ b/spec/ruby/library/etc/getpwuid_spec.rb
@@ -30,7 +30,7 @@ platform_is_not :windows do
-> {
Etc.getpwuid("foo")
Etc.getpwuid(nil)
- }.should raise_error(TypeError)
+ }.should.raise(TypeError)
end
end
end
diff --git a/spec/ruby/library/etc/group_spec.rb b/spec/ruby/library/etc/group_spec.rb
index fda808eec9..d7addbbec1 100644
--- a/spec/ruby/library/etc/group_spec.rb
+++ b/spec/ruby/library/etc/group_spec.rb
@@ -9,7 +9,7 @@ describe "Etc.group" do
it "returns a Etc::Group struct" do
group = Etc.group
begin
- group.should be_an_instance_of(Etc::Group)
+ group.should.instance_of?(Etc::Group)
ensure
Etc.endgrent
end
@@ -21,7 +21,7 @@ describe "Etc.group" do
Etc.group do | group2 |
end
end
- }.should raise_error(RuntimeError)
+ }.should.raise(RuntimeError)
end
end
end
diff --git a/spec/ruby/library/etc/nprocessors_spec.rb b/spec/ruby/library/etc/nprocessors_spec.rb
index ec7ffc81da..482719dde0 100644
--- a/spec/ruby/library/etc/nprocessors_spec.rb
+++ b/spec/ruby/library/etc/nprocessors_spec.rb
@@ -3,7 +3,7 @@ require 'etc'
describe "Etc.nprocessors" do
it "returns the number of online processors" do
- Etc.nprocessors.should be_kind_of(Integer)
+ Etc.nprocessors.should.is_a?(Integer)
Etc.nprocessors.should >= 1
end
end
diff --git a/spec/ruby/library/etc/passwd_spec.rb b/spec/ruby/library/etc/passwd_spec.rb
index d61dada451..0602b7e10b 100644
--- a/spec/ruby/library/etc/passwd_spec.rb
+++ b/spec/ruby/library/etc/passwd_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../spec_helper', __FILE__)
+require_relative '../../spec_helper'
require 'etc'
platform_is_not :windows do
@@ -6,7 +6,7 @@ platform_is_not :windows do
it "returns a Etc::Passwd struct" do
passwd = Etc.passwd
begin
- passwd.should be_an_instance_of(Etc::Passwd)
+ passwd.should.instance_of?(Etc::Passwd)
ensure
Etc.endpwent
end
diff --git a/spec/ruby/library/etc/sysconf_spec.rb b/spec/ruby/library/etc/sysconf_spec.rb
index e7d59d1b22..81ce1ca258 100644
--- a/spec/ruby/library/etc/sysconf_spec.rb
+++ b/spec/ruby/library/etc/sysconf_spec.rb
@@ -1,4 +1,4 @@
-require File.expand_path('../../../spec_helper', __FILE__)
+require_relative '../../spec_helper'
require 'etc'
platform_is_not :windows do
@@ -14,7 +14,7 @@ platform_is_not :windows do
if value.nil?
value.should == nil
else
- value.should be_kind_of(Integer)
+ value.should.is_a?(Integer)
end
end
end
diff --git a/spec/ruby/library/etc/sysconfdir_spec.rb b/spec/ruby/library/etc/sysconfdir_spec.rb
index d54299c513..eb2d6b649a 100644
--- a/spec/ruby/library/etc/sysconfdir_spec.rb
+++ b/spec/ruby/library/etc/sysconfdir_spec.rb
@@ -1,8 +1,8 @@
-require File.expand_path('../../../spec_helper', __FILE__)
+require_relative '../../spec_helper'
require 'etc'
describe "Etc.sysconfdir" do
it "returns a String" do
- Etc.sysconfdir.should be_an_instance_of(String)
+ Etc.sysconfdir.should.instance_of?(String)
end
end
diff --git a/spec/ruby/library/etc/systmpdir_spec.rb b/spec/ruby/library/etc/systmpdir_spec.rb
index 99c82903f8..ed34cb43fc 100644
--- a/spec/ruby/library/etc/systmpdir_spec.rb
+++ b/spec/ruby/library/etc/systmpdir_spec.rb
@@ -1,8 +1,8 @@
-require File.expand_path('../../../spec_helper', __FILE__)
+require_relative '../../spec_helper'
require 'etc'
describe "Etc.systmpdir" do
it "returns a String" do
- Etc.systmpdir.should be_an_instance_of(String)
+ Etc.systmpdir.should.instance_of?(String)
end
end
diff --git a/spec/ruby/library/etc/uname_spec.rb b/spec/ruby/library/etc/uname_spec.rb
new file mode 100644
index 0000000000..1c5fe2a741
--- /dev/null
+++ b/spec/ruby/library/etc/uname_spec.rb
@@ -0,0 +1,14 @@
+require_relative '../../spec_helper'
+require 'etc'
+
+describe "Etc.uname" do
+ it "returns a Hash with the documented keys" do
+ uname = Etc.uname
+ uname.should.is_a?(Hash)
+ uname.should.key?(:sysname)
+ uname.should.key?(:nodename)
+ uname.should.key?(:release)
+ uname.should.key?(:version)
+ uname.should.key?(:machine)
+ end
+end