sys-admin 1.8.1-universal-mingw32 → 1.8.2-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  ###############################################################################
2
4
  # sys_admin_unix_rspec.rb
3
5
  #
@@ -12,60 +14,60 @@ RSpec.describe Sys::Admin, :unix do
12
14
  let(:group) { 'sys' }
13
15
  let(:group_id) { 3 }
14
16
 
15
- context "singleton methods" do
16
- describe "get_login" do
17
- example "get_login basic functionality" do
17
+ context 'singleton methods' do
18
+ describe 'get_login' do
19
+ example 'get_login basic functionality' do
18
20
  expect(described_class).to respond_to(:get_login)
19
21
  expect{ described_class.get_login }.not_to raise_error
20
22
  end
21
23
 
22
- example "get_login returns a string" do
24
+ example 'get_login returns a string' do
23
25
  expect(described_class.get_login).to be_kind_of(String)
24
26
  expect(described_class.get_login.length).to be > 0
25
27
  end
26
28
  end
27
29
 
28
- describe "get_user" do
29
- example "get_user basic functionality" do
30
+ describe 'get_user' do
31
+ example 'get_user basic functionality' do
30
32
  expect(described_class).to respond_to(:get_user)
31
33
  expect{ described_class.get_user(user) }.not_to raise_error
32
34
  expect{ described_class.get_user(user_id) }.not_to raise_error
33
35
  end
34
36
 
35
- example "get_user with a string argument works as expected" do
37
+ example 'get_user with a string argument works as expected' do
36
38
  expect(described_class.get_user(user)).to be_kind_of(Sys::Admin::User)
37
39
  end
38
40
 
39
- example "get_user with an integer argument works as expected" do
41
+ example 'get_user with an integer argument works as expected' do
40
42
  expect(described_class.get_user(user_id)).to be_kind_of(Sys::Admin::User)
41
43
  end
42
44
 
43
- example "get_user requires at least one argument" do
45
+ example 'get_user requires at least one argument' do
44
46
  expect{ described_class.get_user }.to raise_error(ArgumentError)
45
47
  end
46
48
 
47
- example "get_user requires a string or integer argument" do
49
+ example 'get_user requires a string or integer argument' do
48
50
  expect{ described_class.get_user([]) }.to raise_error(TypeError)
49
51
  end
50
52
 
51
- example "get_user raises an Error if the user cannot be found" do
53
+ example 'get_user raises an Error if the user cannot be found' do
52
54
  expect{ described_class.get_user('foofoofoo') }.to raise_error(Sys::Admin::Error)
53
55
  end
54
56
  end
55
57
 
56
- describe "users" do
57
- example "users basic functionality" do
58
+ describe 'users' do
59
+ example 'users basic functionality' do
58
60
  expect(described_class).to respond_to(:users)
59
61
  expect{ described_class.users }.not_to raise_error
60
62
  end
61
63
 
62
- example "users returns an array of User objects" do
64
+ example 'users returns an array of User objects' do
63
65
  users = described_class.users
64
66
  expect(users).to be_kind_of(Array)
65
67
  expect(users).to all(be_kind_of(Sys::Admin::User))
66
68
  end
67
69
 
68
- example "users accepts an optional lastlog argument on darwin", :darwin => true do
70
+ example 'users accepts an optional lastlog argument on darwin', :darwin => true do
69
71
  users = described_class.users(:lastlog => false)
70
72
  expect(users).to be_kind_of(Array)
71
73
  expect(users).to all(be_kind_of(Sys::Admin::User))
@@ -73,178 +75,178 @@ RSpec.describe Sys::Admin, :unix do
73
75
  end
74
76
  end
75
77
 
76
- describe "get_group" do
77
- example "get_group basic functionality" do
78
+ describe 'get_group' do
79
+ example 'get_group basic functionality' do
78
80
  expect(described_class).to respond_to(:get_group)
79
81
  expect{ described_class.get_group(group) }.not_to raise_error
80
82
  expect{ described_class.get_group(group_id) }.not_to raise_error
81
83
  end
82
84
 
83
- example "get_group accepts a string argument" do
85
+ example 'get_group accepts a string argument' do
84
86
  expect(described_class.get_group(group)).to be_kind_of(Sys::Admin::Group)
85
87
  end
86
88
 
87
- example "get_group accepts an integer argument" do
89
+ example 'get_group accepts an integer argument' do
88
90
  expect(described_class.get_group(group_id)).to be_kind_of(Sys::Admin::Group)
89
91
  end
90
92
 
91
- example "get_group requires one argument only" do
93
+ example 'get_group requires one argument only' do
92
94
  expect{ described_class.get_group }.to raise_error(ArgumentError)
93
95
  expect{ described_class.get_group(group_id, group_id) }.to raise_error(ArgumentError)
94
96
  end
95
97
 
96
- example "get_group raises a TypeError if an invalid type is passed" do
98
+ example 'get_group raises a TypeError if an invalid type is passed' do
97
99
  expect{ described_class.get_group([]) }.to raise_error(TypeError)
98
100
  end
99
101
 
100
- example "get_group raises an Error if the group cannot be found" do
102
+ example 'get_group raises an Error if the group cannot be found' do
101
103
  expect{ described_class.get_group('foofoofoo') }.to raise_error(Sys::Admin::Error)
102
104
  end
103
105
  end
104
106
 
105
- describe "groups" do
106
- example "groups basic functionality" do
107
+ describe 'groups' do
108
+ example 'groups basic functionality' do
107
109
  expect(described_class).to respond_to(:groups)
108
110
  expect{ described_class.groups }.not_to raise_error
109
111
  end
110
112
 
111
- example "groups returns an array of Group objects" do
113
+ example 'groups returns an array of Group objects' do
112
114
  groups = described_class.groups
113
115
  expect(groups).to be_kind_of(Array)
114
116
  expect(groups).to all(be_kind_of(Sys::Admin::Group))
115
117
  end
116
118
 
117
- example "groups method does not accept any arguments" do
119
+ example 'groups method does not accept any arguments' do
118
120
  expect{ described_class.groups(group_id) }.to raise_error(ArgumentError)
119
121
  end
120
122
  end
121
123
  end
122
124
 
123
- context "instance methods" do
124
- describe "User instance methods" do
125
- example "user.name behaves as expected" do
125
+ context 'instance methods' do
126
+ describe 'User instance methods' do
127
+ example 'user.name behaves as expected' do
126
128
  user = described_class.get_user(user_id)
127
129
  expect(user).to respond_to(:name)
128
130
  expect(user.name).to be_kind_of(String)
129
131
  end
130
132
 
131
- example "user.passwd behaves as expected" do
133
+ example 'user.passwd behaves as expected' do
132
134
  user = described_class.get_user(user_id)
133
135
  expect(user).to respond_to(:passwd)
134
136
  expect(user.passwd).to be_kind_of(String)
135
137
  end
136
138
 
137
- example "user.uid behaves as expected" do
139
+ example 'user.uid behaves as expected' do
138
140
  user = described_class.get_user(user_id)
139
141
  expect(user).to respond_to(:uid)
140
142
  expect(user.uid).to be_kind_of(Integer)
141
143
  end
142
144
 
143
- example "user.gid behaves as expected" do
145
+ example 'user.gid behaves as expected' do
144
146
  user = described_class.get_user(user_id)
145
147
  expect(user).to respond_to(:gid)
146
148
  expect(user.gid).to be_kind_of(Integer)
147
149
  end
148
150
 
149
- example "user.dir behaves as expected" do
151
+ example 'user.dir behaves as expected' do
150
152
  user = described_class.get_user(user_id)
151
153
  expect(user).to respond_to(:dir)
152
154
  expect(user.dir).to be_kind_of(String)
153
155
  end
154
156
 
155
- example "user.shell behaves as expected" do
157
+ example 'user.shell behaves as expected' do
156
158
  user = described_class.get_user(user_id)
157
159
  expect(user).to respond_to(:shell)
158
160
  expect(user.shell).to be_kind_of(String)
159
161
  end
160
162
 
161
- example "user.gecos behaves as expected" do
163
+ example 'user.gecos behaves as expected' do
162
164
  user = described_class.get_user(user_id)
163
165
  expect(user).to respond_to(:gecos)
164
166
  expect(user.gecos).to be_kind_of(String).or be_nil
165
167
  end
166
168
 
167
- example "user.quota behaves as expected" do
169
+ example 'user.quota behaves as expected' do
168
170
  user = described_class.get_user(user_id)
169
171
  expect(user).to respond_to(:quota)
170
172
  expect(user.quota).to be_kind_of(Integer).or be_nil
171
173
  end
172
174
 
173
- example "user.age behaves as expected" do
175
+ example 'user.age behaves as expected' do
174
176
  user = described_class.get_user(user_id)
175
177
  expect(user).to respond_to(:age)
176
178
  expect(user.age).to be_kind_of(Integer).or be_nil
177
179
  end
178
180
 
179
- example "user.access behaves as expected" do
181
+ example 'user.access behaves as expected' do
180
182
  user = described_class.get_user(user_id)
181
183
  expect(user).to respond_to(:access_class)
182
184
  expect(user.access_class).to be_kind_of(String).or be_nil
183
185
  end
184
186
 
185
- example "user.comment behaves as expected" do
187
+ example 'user.comment behaves as expected' do
186
188
  user = described_class.get_user(user_id)
187
189
  expect(user).to respond_to(:comment)
188
190
  expect(user.comment).to be_kind_of(String).or be_nil
189
191
  end
190
192
 
191
- example "user.expire behaves as expected" do
193
+ example 'user.expire behaves as expected' do
192
194
  user = described_class.get_user(user_id)
193
195
  expect(user).to respond_to(:expire)
194
196
  expect(user.expire).to be_kind_of(Time).or be_nil
195
197
  end
196
198
 
197
- example "user.change behaves as expected" do
199
+ example 'user.change behaves as expected' do
198
200
  user = described_class.get_user(user_id)
199
201
  expect(user).to respond_to(:change)
200
202
  expect(user.change).to be_kind_of(Time).or be_nil
201
203
  end
202
204
 
203
- example "user.login_time behaves as expected" do
205
+ example 'user.login_time behaves as expected' do
204
206
  user = described_class.get_user(user_id)
205
207
  expect(user).to respond_to(:login_time)
206
208
  expect(user.login_time).to be_kind_of(Time).or be_nil
207
209
  end
208
210
 
209
- example "user.login_device behaves as expected" do
211
+ example 'user.login_device behaves as expected' do
210
212
  user = described_class.get_user(user_id)
211
213
  expect(user).to respond_to(:login_device)
212
214
  expect(user.login_device).to be_kind_of(String).or be_nil
213
215
  end
214
216
 
215
- example "user.login_host behaves as expected" do
217
+ example 'user.login_host behaves as expected' do
216
218
  user = described_class.get_user(user_id)
217
219
  expect(user).to respond_to(:login_host)
218
220
  expect(user.login_host).to be_kind_of(String).or be_nil
219
221
  end
220
222
 
221
- example "user.groups behaves as expected" do
223
+ example 'user.groups behaves as expected' do
222
224
  user = described_class.get_user(user_id)
223
225
  expect(user).to respond_to(:groups)
224
226
  expect(user.groups).to be_kind_of(Array)
225
227
  end
226
228
  end
227
229
 
228
- describe "Group instance methods" do
229
- example "group.name behaves as expected" do
230
+ describe 'Group instance methods' do
231
+ example 'group.name behaves as expected' do
230
232
  group = described_class.get_group(group_id)
231
233
  expect(group).to respond_to(:name)
232
234
  expect(group.name).to be_kind_of(String)
233
235
  end
234
236
 
235
- example "group.gid behaves as expected" do
237
+ example 'group.gid behaves as expected' do
236
238
  group = described_class.get_group(group_id)
237
239
  expect(group).to respond_to(:gid)
238
240
  expect(group.gid).to be_kind_of(Integer)
239
241
  end
240
242
 
241
- example "group.members behaves as expected" do
243
+ example 'group.members behaves as expected' do
242
244
  group = described_class.get_group(group_id)
243
245
  expect(group).to respond_to(:members)
244
246
  expect(group.members).to be_kind_of(Array)
245
247
  end
246
248
 
247
- example "group.passwd behaves as expected" do
249
+ example 'group.passwd behaves as expected' do
248
250
  group = described_class.get_group(group_id)
249
251
  expect(group).to respond_to(:passwd)
250
252
  expect(group.passwd).to be_kind_of(String)
@@ -252,8 +254,8 @@ RSpec.describe Sys::Admin, :unix do
252
254
  end
253
255
  end
254
256
 
255
- context "ffi functions" do
256
- example "ffi functions are private" do
257
+ context 'ffi functions' do
258
+ example 'ffi functions are private' do
257
259
  methods = described_class.methods(false).map(&:to_s)
258
260
  expect(methods).not_to include('getlogin')
259
261
  expect(methods).not_to include('getlogin_r')