sys-filesystem 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +4 -0
- data/Rakefile +13 -0
- data/lib/sys/filesystem.rb +17 -16
- data/lib/sys/unix/sys/filesystem/constants.rb +2 -0
- data/lib/sys/unix/sys/filesystem/functions.rb +10 -4
- data/lib/sys/unix/sys/filesystem/structs.rb +84 -70
- data/lib/sys/unix/sys/filesystem.rb +3 -3
- data/lib/sys/windows/sys/filesystem/functions.rb +1 -0
- data/lib/sys/windows/sys/filesystem/helper.rb +3 -0
- data/lib/sys/windows/sys/filesystem.rb +13 -11
- data/lib/sys-filesystem.rb +2 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/sys_filesystem_shared.rb +14 -0
- data/spec/sys_filesystem_unix_spec.rb +235 -124
- data/spec/sys_filesystem_windows_spec.rb +263 -151
- data/sys-filesystem.gemspec +15 -7
- data.tar.gz.sig +0 -0
- metadata +34 -3
- metadata.gz.sig +2 -1
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
####################################################################
|
2
4
|
# sys_filesystem_windows_spec.rb
|
3
5
|
#
|
@@ -12,337 +14,447 @@ RSpec.describe Sys::Filesystem, :windows => true do
|
|
12
14
|
let(:root) { 'C:/' }
|
13
15
|
|
14
16
|
before do
|
15
|
-
@stat =
|
17
|
+
@stat = described_class.stat(root)
|
16
18
|
@size = 58720256
|
17
19
|
end
|
18
20
|
|
19
|
-
example
|
20
|
-
expect(Sys::Filesystem::VERSION).to eq('1.4.3')
|
21
|
-
expect(Sys::Filesystem::VERSION).to be_frozen
|
22
|
-
end
|
23
|
-
|
24
|
-
example "you cannot instantiate an instance" do
|
25
|
-
expect{ described_class.new }.to raise_error(NoMethodError)
|
26
|
-
end
|
27
|
-
|
28
|
-
example "stat path works as expected" do
|
21
|
+
example 'stat path works as expected' do
|
29
22
|
expect(@stat).to respond_to(:path)
|
30
23
|
expect(@stat.path).to eq(root)
|
31
24
|
end
|
32
25
|
|
33
|
-
example
|
26
|
+
example 'stat block_size works as expected' do
|
34
27
|
expect(@stat).to respond_to(:block_size)
|
35
|
-
expect(@stat.block_size).to
|
28
|
+
expect(@stat.block_size).to be_a(Numeric)
|
36
29
|
end
|
37
30
|
|
38
|
-
example
|
39
|
-
expect(
|
40
|
-
expect(
|
41
|
-
expect(
|
42
|
-
expect(
|
31
|
+
example 'stat works with or without trailing slash on standard paths' do
|
32
|
+
expect(described_class.stat('C:/').path).to eq('C:/')
|
33
|
+
expect(described_class.stat('C:/Users').path).to eq('C:/Users')
|
34
|
+
expect(described_class.stat('C:/Users/').path).to eq('C:/Users/')
|
35
|
+
expect(described_class.stat('C:/Users/').path).to eq('C:/Users/')
|
43
36
|
end
|
44
37
|
|
45
|
-
example
|
46
|
-
expect(
|
47
|
-
expect(
|
48
|
-
expect(
|
49
|
-
expect(
|
38
|
+
example 'stat works with or without trailing slash on UNC paths' do
|
39
|
+
expect(described_class.stat('//127.0.0.1/C$').path).to eq('//127.0.0.1/C$')
|
40
|
+
expect(described_class.stat('//127.0.0.1/C$/').path).to eq('//127.0.0.1/C$/')
|
41
|
+
expect(described_class.stat('\\\\127.0.0.1\\C$').path).to eq('\\\\127.0.0.1\\C$')
|
42
|
+
expect(described_class.stat('\\\\127.0.0.1\\C$\\').path).to eq('\\\\127.0.0.1\\C$\\')
|
50
43
|
end
|
51
44
|
|
52
|
-
example
|
45
|
+
example 'stat fragment_size works as expected' do
|
53
46
|
expect(@stat).to respond_to(:fragment_size)
|
54
47
|
expect(@stat.fragment_size).to be_nil
|
55
48
|
end
|
56
49
|
|
57
|
-
example
|
50
|
+
example 'stat blocks works as expected' do
|
58
51
|
expect(@stat).to respond_to(:blocks)
|
59
|
-
expect(@stat.blocks).to
|
52
|
+
expect(@stat.blocks).to be_a(Numeric)
|
60
53
|
end
|
61
54
|
|
62
|
-
example
|
55
|
+
example 'stat blocks_free works as expected' do
|
63
56
|
expect(@stat).to respond_to(:blocks_free)
|
64
|
-
expect(@stat.blocks_free).to
|
57
|
+
expect(@stat.blocks_free).to be_a(Numeric)
|
65
58
|
end
|
66
59
|
|
67
|
-
example
|
60
|
+
example 'stat blocks_available works as expected' do
|
68
61
|
expect(@stat).to respond_to(:blocks_available)
|
69
|
-
expect(@stat.blocks_available).to
|
62
|
+
expect(@stat.blocks_available).to be_a(Numeric)
|
70
63
|
end
|
71
64
|
|
72
|
-
example
|
65
|
+
example 'block stats return expected relative values' do
|
73
66
|
expect(@stat.blocks >= @stat.blocks_free).to be true
|
74
67
|
expect(@stat.blocks_free >= @stat.blocks_available).to be true
|
75
68
|
end
|
76
69
|
|
77
|
-
example
|
70
|
+
example 'stat files works as expected' do
|
78
71
|
expect(@stat).to respond_to(:files)
|
79
72
|
expect(@stat.files).to be_nil
|
80
73
|
end
|
81
74
|
|
82
|
-
example
|
75
|
+
example 'stat inodes is an alias for files' do
|
83
76
|
expect(@stat.method(:inodes)).to eq(@stat.method(:files))
|
84
77
|
end
|
85
78
|
|
86
|
-
example
|
79
|
+
example 'stat files_free works as expected' do
|
87
80
|
expect(@stat).to respond_to(:files_free)
|
88
81
|
expect(@stat.files_free).to be_nil
|
89
82
|
end
|
90
83
|
|
91
|
-
example
|
84
|
+
example 'stat inodes_free is an alias for files_free' do
|
92
85
|
expect(@stat).to respond_to(:inodes_free)
|
93
86
|
end
|
94
87
|
|
95
|
-
example
|
88
|
+
example 'stat files available works as expected' do
|
96
89
|
expect(@stat).to respond_to(:files_available)
|
97
90
|
expect(@stat.files_available).to be_nil
|
98
91
|
end
|
99
92
|
|
100
|
-
example
|
93
|
+
example 'stat inodes_available is an alias for files_available' do
|
101
94
|
expect(@stat.method(:inodes_available)).to eq(@stat.method(:files_available))
|
102
95
|
end
|
103
96
|
|
104
|
-
example
|
97
|
+
example 'stat filesystem_id works as expected' do
|
105
98
|
expect(@stat).to respond_to(:filesystem_id)
|
106
|
-
expect(@stat.filesystem_id).to
|
99
|
+
expect(@stat.filesystem_id).to be_a(Integer)
|
107
100
|
end
|
108
101
|
|
109
|
-
example
|
102
|
+
example 'stat flags works as expected' do
|
110
103
|
expect(@stat).to respond_to(:flags)
|
111
|
-
expect(@stat.flags).to
|
104
|
+
expect(@stat.flags).to be_a(Numeric)
|
112
105
|
end
|
113
106
|
|
114
|
-
example
|
107
|
+
example 'stat name_max works as expected' do
|
115
108
|
expect(@stat).to respond_to(:name_max)
|
116
|
-
expect(@stat.name_max).to
|
109
|
+
expect(@stat.name_max).to be_a(Numeric)
|
117
110
|
end
|
118
111
|
|
119
|
-
example
|
112
|
+
example 'stat base_type works as expected' do
|
120
113
|
expect(@stat).to respond_to(:base_type)
|
121
|
-
expect(@stat.base_type).to
|
114
|
+
expect(@stat.base_type).to be_a(String)
|
122
115
|
end
|
123
116
|
|
124
|
-
example
|
117
|
+
example 'stat bytes_total basic functionality' do
|
125
118
|
expect(@stat).to respond_to(:bytes_total)
|
126
|
-
expect(@stat.bytes_total).to
|
119
|
+
expect(@stat.bytes_total).to be_a(Numeric)
|
127
120
|
end
|
128
121
|
|
129
|
-
example
|
122
|
+
example 'stat bytes_free basic functionality' do
|
130
123
|
expect(@stat).to respond_to(:bytes_free)
|
131
|
-
expect(@stat.bytes_free).to
|
124
|
+
expect(@stat.bytes_free).to be_a(Numeric)
|
132
125
|
expect(@stat.blocks_free * @stat.block_size).to eq(@stat.bytes_free)
|
133
126
|
end
|
134
127
|
|
135
|
-
example
|
128
|
+
example 'stat bytes_available basic functionality' do
|
136
129
|
expect(@stat).to respond_to(:bytes_available)
|
137
|
-
expect(@stat.bytes_available).to
|
130
|
+
expect(@stat.bytes_available).to be_a(Numeric)
|
138
131
|
expect(@stat.blocks_available * @stat.block_size).to eq(@stat.bytes_available)
|
139
132
|
end
|
140
133
|
|
141
|
-
example
|
134
|
+
example 'stat bytes_used basic functionality' do
|
142
135
|
expect(@stat).to respond_to(:bytes_used)
|
143
|
-
expect(@stat.bytes_used).to
|
136
|
+
expect(@stat.bytes_used).to be_a(Numeric)
|
144
137
|
end
|
145
138
|
|
146
|
-
example
|
139
|
+
example 'stat percent_used basic functionality' do
|
147
140
|
expect(@stat).to respond_to(:percent_used)
|
148
|
-
expect(@stat.percent_used).to
|
141
|
+
expect(@stat.percent_used).to be_a(Float)
|
149
142
|
end
|
150
143
|
|
151
|
-
example
|
144
|
+
example 'case_insensitive returns expected result' do
|
152
145
|
expect(@stat).to respond_to(:case_insensitive?)
|
153
|
-
expect(@stat.case_insensitive?).to
|
146
|
+
expect(@stat.case_insensitive?).to be(true)
|
154
147
|
end
|
155
148
|
|
156
|
-
context
|
149
|
+
context 'Filesystem.stat(Pathname)' do
|
157
150
|
before do
|
158
|
-
@stat_pathname =
|
151
|
+
@stat_pathname = described_class.stat(Pathname.new(root))
|
159
152
|
end
|
160
153
|
|
161
|
-
example
|
154
|
+
example 'class returns expected value with pathname argument' do
|
162
155
|
expect(@stat_pathname.class).to eq(@stat.class)
|
156
|
+
end
|
157
|
+
|
158
|
+
example 'path returns expected value with pathname argument' do
|
163
159
|
expect(@stat_pathname.path).to eq(@stat.path)
|
160
|
+
end
|
161
|
+
|
162
|
+
example 'block_size returns expected value with pathname argument' do
|
164
163
|
expect(@stat_pathname.block_size).to eq(@stat.block_size)
|
164
|
+
end
|
165
|
+
|
166
|
+
example 'fragment_size returns expected value with pathname argument' do
|
165
167
|
expect(@stat_pathname.fragment_size).to eq(@stat.fragment_size)
|
168
|
+
end
|
169
|
+
|
170
|
+
example 'blocks returns expected value with pathname argument' do
|
166
171
|
expect(@stat_pathname.blocks).to eq(@stat.blocks)
|
172
|
+
end
|
173
|
+
|
174
|
+
example 'blocks_free returns expected value with pathname argument' do
|
167
175
|
expect(@stat_pathname.blocks_free).to eq(@stat.blocks_free)
|
176
|
+
end
|
177
|
+
|
178
|
+
example 'blocks_available returns expected value with pathname argument' do
|
168
179
|
expect(@stat_pathname.blocks_available).to eq(@stat.blocks_available)
|
180
|
+
end
|
181
|
+
|
182
|
+
example 'files returns expected value with pathname argument' do
|
169
183
|
expect(@stat_pathname.files).to eq(@stat.files)
|
184
|
+
end
|
185
|
+
|
186
|
+
example 'files_free returns expected value with pathname argument' do
|
170
187
|
expect(@stat_pathname.files_free).to eq(@stat.files_free)
|
188
|
+
end
|
189
|
+
|
190
|
+
example 'files_available returns expected value with pathname argument' do
|
171
191
|
expect(@stat_pathname.files_available).to eq(@stat.files_available)
|
192
|
+
end
|
193
|
+
|
194
|
+
example 'filesystem_id returns expected value with pathname argument' do
|
172
195
|
expect(@stat_pathname.filesystem_id).to eq(@stat.filesystem_id)
|
196
|
+
end
|
197
|
+
|
198
|
+
example 'flags returns expected value with pathname argument' do
|
173
199
|
expect(@stat_pathname.flags).to eq(@stat.flags)
|
200
|
+
end
|
201
|
+
|
202
|
+
example 'name_max returns expected value with pathname argument' do
|
174
203
|
expect(@stat_pathname.name_max).to eq(@stat.name_max)
|
204
|
+
end
|
205
|
+
|
206
|
+
example 'base_type returns expected value with pathname argument' do
|
175
207
|
expect(@stat_pathname.base_type).to eq(@stat.base_type)
|
176
208
|
end
|
177
209
|
end
|
178
210
|
|
179
|
-
context
|
211
|
+
context 'Filesystem.stat(Dir)' do
|
180
212
|
before do
|
181
|
-
@stat_dir = Dir.open(root){ |dir|
|
213
|
+
@stat_dir = Dir.open(root){ |dir| described_class.stat(dir) }
|
214
|
+
end
|
215
|
+
|
216
|
+
example 'stat class with Dir argument works as expected' do
|
217
|
+
expect(@stat_dir.class).to eq(@stat.class)
|
218
|
+
end
|
219
|
+
|
220
|
+
example 'stat path with Dir argument works as expected' do
|
221
|
+
expect(@stat_dir.path).to eq(@stat.path)
|
222
|
+
end
|
223
|
+
|
224
|
+
example 'stat block_size with Dir argument works as expected' do
|
225
|
+
expect(@stat_dir.block_size).to eq(@stat.block_size)
|
226
|
+
end
|
227
|
+
|
228
|
+
example 'stat fragment_size with Dir argument works as expected' do
|
229
|
+
expect(@stat_dir.fragment_size).to eq(@stat.fragment_size)
|
230
|
+
end
|
231
|
+
|
232
|
+
example 'stat blocks with Dir argument works as expected' do
|
233
|
+
expect(@stat_dir.blocks).to eq(@stat.blocks)
|
234
|
+
end
|
235
|
+
|
236
|
+
example 'stat blocks_free with Dir argument works as expected' do
|
237
|
+
expect(@stat_dir.blocks_free).to eq(@stat.blocks_free)
|
238
|
+
end
|
239
|
+
|
240
|
+
example 'stat blocks_available with Dir argument works as expected' do
|
241
|
+
expect(@stat_dir.blocks_available).to eq(@stat.blocks_available)
|
242
|
+
end
|
243
|
+
|
244
|
+
example 'stat files with Dir argument works as expected' do
|
245
|
+
expect(@stat_dir.files).to eq(@stat.files)
|
246
|
+
end
|
247
|
+
|
248
|
+
example 'stat files_free with Dir argument works as expected' do
|
249
|
+
expect(@stat_dir.files_free).to eq(@stat.files_free)
|
250
|
+
end
|
251
|
+
|
252
|
+
example 'stat files_available with Dir argument works as expected' do
|
253
|
+
expect(@stat_dir.files_available).to eq(@stat.files_available)
|
254
|
+
end
|
255
|
+
|
256
|
+
example 'stat filesystem_id with Dir argument works as expected' do
|
257
|
+
expect(@stat_dir.filesystem_id).to eq(@stat.filesystem_id)
|
182
258
|
end
|
183
259
|
|
184
|
-
example
|
185
|
-
expect(
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
expect(
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
expect(
|
194
|
-
expect( @stat_dir.files_available).to eq(@stat.files_available)
|
195
|
-
expect( @stat_dir.filesystem_id).to eq(@stat.filesystem_id)
|
196
|
-
expect( @stat_dir.flags).to eq(@stat.flags)
|
197
|
-
expect( @stat_dir.name_max).to eq(@stat.name_max)
|
198
|
-
expect( @stat_dir.base_type).to eq(@stat.base_type)
|
260
|
+
example 'stat flags with Dir argument works as expected' do
|
261
|
+
expect(@stat_dir.flags).to eq(@stat.flags)
|
262
|
+
end
|
263
|
+
|
264
|
+
example 'stat name_max with Dir argument works as expected' do
|
265
|
+
expect(@stat_dir.name_max).to eq(@stat.name_max)
|
266
|
+
end
|
267
|
+
|
268
|
+
example 'stat base_type with Dir argument works as expected' do
|
269
|
+
expect(@stat_dir.base_type).to eq(@stat.base_type)
|
199
270
|
end
|
200
271
|
end
|
201
272
|
|
202
|
-
context
|
203
|
-
example
|
204
|
-
expect(
|
205
|
-
expect{
|
206
|
-
expect(
|
273
|
+
context 'mount_point' do
|
274
|
+
example 'mount_point singleton method basic functionality' do
|
275
|
+
expect(described_class).to respond_to(:mount_point)
|
276
|
+
expect{ described_class.mount_point(Dir.pwd) }.not_to raise_error
|
277
|
+
expect(described_class.mount_point(Dir.pwd)).to be_a(String)
|
207
278
|
end
|
208
279
|
|
209
|
-
example
|
210
|
-
expect(
|
211
|
-
expect(
|
280
|
+
example 'mount_point singleton method returns expected value' do
|
281
|
+
expect(described_class.mount_point('C:\\Users\\foo')).to eq('C:\\')
|
282
|
+
expect(described_class.mount_point('//foo/bar/baz')).to eq('\\\\foo\\bar')
|
212
283
|
end
|
213
284
|
|
214
|
-
example
|
215
|
-
expect{
|
216
|
-
expect(
|
217
|
-
expect(
|
285
|
+
example 'mount_point works with Pathname object' do
|
286
|
+
expect{ described_class.mount_point(Pathname.new('C:/Users/foo')) }.not_to raise_error
|
287
|
+
expect(described_class.mount_point('C:\\Users\\foo')).to eq('C:\\')
|
288
|
+
expect(described_class.mount_point('//foo/bar/baz')).to eq('\\\\foo\\bar')
|
218
289
|
end
|
219
290
|
end
|
220
291
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
292
|
+
context 'filesystem constants are defined' do
|
293
|
+
example 'CASE_SENSITIVE_SEARCH' do
|
294
|
+
expect(Sys::Filesystem::CASE_SENSITIVE_SEARCH).not_to be_nil
|
295
|
+
end
|
296
|
+
|
297
|
+
example 'CASE_PRESERVED_NAMES' do
|
298
|
+
expect(Sys::Filesystem::CASE_PRESERVED_NAMES).not_to be_nil
|
299
|
+
end
|
300
|
+
|
301
|
+
example 'UNICODE_ON_DISK' do
|
302
|
+
expect(Sys::Filesystem::UNICODE_ON_DISK).not_to be_nil
|
303
|
+
end
|
304
|
+
|
305
|
+
example 'PERSISTENT_ACLS' do
|
306
|
+
expect(Sys::Filesystem::PERSISTENT_ACLS).not_to be_nil
|
307
|
+
end
|
308
|
+
|
309
|
+
example 'FILE_COMPRESSION' do
|
310
|
+
expect(Sys::Filesystem::FILE_COMPRESSION).not_to be_nil
|
311
|
+
end
|
312
|
+
|
313
|
+
example 'VOLUME_QUOTAS' do
|
314
|
+
expect(Sys::Filesystem::VOLUME_QUOTAS).not_to be_nil
|
315
|
+
end
|
316
|
+
|
317
|
+
example 'SUPPORTS_SPARSE_FILES' do
|
318
|
+
expect(Sys::Filesystem::SUPPORTS_SPARSE_FILES).not_to be_nil
|
319
|
+
end
|
320
|
+
|
321
|
+
example 'SUPPORTS_REPARSE_POINTS' do
|
322
|
+
expect(Sys::Filesystem::SUPPORTS_REPARSE_POINTS).not_to be_nil
|
323
|
+
end
|
324
|
+
|
325
|
+
example 'SUPPORTS_REMOTE_STORAGE' do
|
326
|
+
expect(Sys::Filesystem::SUPPORTS_REMOTE_STORAGE).not_to be_nil
|
327
|
+
end
|
328
|
+
|
329
|
+
example 'VOLUME_IS_COMPRESSED' do
|
330
|
+
expect(Sys::Filesystem::VOLUME_IS_COMPRESSED).not_to be_nil
|
331
|
+
end
|
332
|
+
|
333
|
+
example 'SUPPORTS_OBJECT_IDS' do
|
334
|
+
expect(Sys::Filesystem::SUPPORTS_OBJECT_IDS).not_to be_nil
|
335
|
+
end
|
336
|
+
|
337
|
+
example 'SUPPORTS_ENCRYPTION' do
|
338
|
+
expect(Sys::Filesystem::SUPPORTS_ENCRYPTION).not_to be_nil
|
339
|
+
end
|
340
|
+
|
341
|
+
example 'NAMED_STREAMS' do
|
342
|
+
expect(Sys::Filesystem::NAMED_STREAMS).not_to be_nil
|
343
|
+
end
|
344
|
+
|
345
|
+
example 'READ_ONLY_VOLUME' do
|
346
|
+
expect(Sys::Filesystem::READ_ONLY_VOLUME).not_to be_nil
|
347
|
+
end
|
236
348
|
end
|
237
349
|
|
238
|
-
example
|
239
|
-
expect{
|
350
|
+
example 'stat singleton method defaults to root path if proviced' do
|
351
|
+
expect{ described_class.stat('C://Program Files') }.not_to raise_error
|
240
352
|
end
|
241
353
|
|
242
|
-
example
|
243
|
-
expect{
|
354
|
+
example 'stat singleton method accepts a Pathname object' do
|
355
|
+
expect{ described_class.stat(Pathname.new('C://Program Files')) }.not_to raise_error
|
244
356
|
end
|
245
357
|
|
246
|
-
example
|
247
|
-
expect{
|
248
|
-
expect{
|
358
|
+
example 'stat singleton method requires a single argument' do
|
359
|
+
expect{ described_class.stat }.to raise_error(ArgumentError)
|
360
|
+
expect{ described_class.stat(Dir.pwd, Dir.pwd) }.to raise_error(ArgumentError)
|
249
361
|
end
|
250
362
|
|
251
|
-
example
|
252
|
-
expect{
|
363
|
+
example 'stat singleton method raises an error if path is not found' do
|
364
|
+
expect{ described_class.stat('C://Bogus//Dir') }.to raise_error(Errno::ESRCH)
|
253
365
|
end
|
254
366
|
|
255
|
-
context
|
256
|
-
let(:mount){
|
367
|
+
context 'Filesystem::Mount' do
|
368
|
+
let(:mount){ described_class.mounts[0] }
|
257
369
|
|
258
370
|
before do
|
259
371
|
@array = []
|
260
372
|
end
|
261
373
|
|
262
|
-
example
|
263
|
-
expect(
|
374
|
+
example 'mount singleton method exists' do
|
375
|
+
expect(described_class).to respond_to(:mount)
|
264
376
|
end
|
265
377
|
|
266
|
-
example
|
267
|
-
expect(
|
378
|
+
example 'umount singleton method exists' do
|
379
|
+
expect(described_class).to respond_to(:umount)
|
268
380
|
end
|
269
381
|
|
270
|
-
example
|
271
|
-
expect(
|
272
|
-
expect{
|
273
|
-
expect{
|
382
|
+
example 'mounts singleton method basic functionality' do
|
383
|
+
expect(described_class).to respond_to(:mounts)
|
384
|
+
expect{ described_class.mounts }.not_to raise_error
|
385
|
+
expect{ described_class.mounts{} }.not_to raise_error
|
274
386
|
end
|
275
387
|
|
276
|
-
example
|
277
|
-
expect(
|
278
|
-
expect(
|
388
|
+
example 'mounts singleton method returns the expected value' do
|
389
|
+
expect(described_class.mounts).to be_a(Array)
|
390
|
+
expect(described_class.mounts[0]).to be_a(Sys::Filesystem::Mount)
|
279
391
|
end
|
280
392
|
|
281
|
-
example
|
282
|
-
expect(
|
283
|
-
expect{
|
284
|
-
expect(@array[0]).to
|
393
|
+
example 'mounts singleton method works as expected when a block is provided' do
|
394
|
+
expect(described_class.mounts{}).to be_nil
|
395
|
+
expect{ described_class.mounts{ |mt| @array << mt } }.not_to raise_error
|
396
|
+
expect(@array[0]).to be_a(Sys::Filesystem::Mount)
|
285
397
|
end
|
286
398
|
|
287
|
-
example
|
399
|
+
example 'mount name works as expected' do
|
288
400
|
expect(mount).to respond_to(:name)
|
289
|
-
expect(mount.name).to
|
401
|
+
expect(mount.name).to be_a(String)
|
290
402
|
end
|
291
403
|
|
292
|
-
example
|
404
|
+
example 'mount_time works as expected' do
|
293
405
|
expect(mount).to respond_to(:mount_time)
|
294
|
-
expect(mount.mount_time).to
|
406
|
+
expect(mount.mount_time).to be_a(Time)
|
295
407
|
end
|
296
408
|
|
297
|
-
example
|
409
|
+
example 'mount type works as expected' do
|
298
410
|
expect(mount).to respond_to(:mount_type)
|
299
|
-
expect(mount.mount_type).to
|
411
|
+
expect(mount.mount_type).to be_a(String)
|
300
412
|
end
|
301
413
|
|
302
|
-
example
|
414
|
+
example 'mount point works as expected' do
|
303
415
|
expect(mount).to respond_to(:mount_point)
|
304
|
-
expect(mount.mount_point).to
|
416
|
+
expect(mount.mount_point).to be_a(String)
|
305
417
|
end
|
306
418
|
|
307
|
-
example
|
419
|
+
example 'mount options works as expected' do
|
308
420
|
expect(mount).to respond_to(:options)
|
309
|
-
expect(mount.options).to
|
421
|
+
expect(mount.options).to be_a(String)
|
310
422
|
end
|
311
423
|
|
312
|
-
example
|
424
|
+
example 'mount pass_number works as expected' do
|
313
425
|
expect(mount).to respond_to(:pass_number)
|
314
426
|
expect(mount.pass_number).to be_nil
|
315
427
|
end
|
316
428
|
|
317
|
-
example
|
429
|
+
example 'mount frequency works as expected' do
|
318
430
|
expect(mount).to respond_to(:frequency)
|
319
431
|
expect(mount.frequency).to be_nil
|
320
432
|
end
|
321
433
|
|
322
|
-
example
|
323
|
-
expect{
|
434
|
+
example 'mounts singleton method does not accept any arguments' do
|
435
|
+
expect{ described_class.mounts('C:\\') }.to raise_error(ArgumentError)
|
324
436
|
end
|
325
437
|
end
|
326
438
|
|
327
|
-
example
|
439
|
+
example 'custom Numeric#to_kb method works as expected' do
|
328
440
|
expect(@size).to respond_to(:to_kb)
|
329
441
|
expect(@size.to_kb).to eq(57344)
|
330
442
|
end
|
331
443
|
|
332
|
-
example
|
444
|
+
example 'custom Numeric#to_mb method works as expected' do
|
333
445
|
expect(@size).to respond_to(:to_mb)
|
334
446
|
expect(@size.to_mb).to eq(56)
|
335
447
|
end
|
336
448
|
|
337
|
-
example
|
449
|
+
example 'custom Numeric#to_gb method works as expected' do
|
338
450
|
expect(@size).to respond_to(:to_gb)
|
339
451
|
expect(@size.to_gb).to eq(0)
|
340
452
|
end
|
341
453
|
|
342
|
-
context
|
343
|
-
example
|
344
|
-
expect(
|
345
|
-
expect(
|
454
|
+
context 'FFI' do
|
455
|
+
example 'internal ffi functions are not public' do
|
456
|
+
expect(described_class.methods.include?(:GetVolumeInformationA)).to be(false)
|
457
|
+
expect(described_class.instance_methods.include?(:GetVolumeInformationA)).to be(false)
|
346
458
|
end
|
347
459
|
end
|
348
460
|
end
|
data/sys-filesystem.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'sys-filesystem'
|
5
|
-
spec.version = '1.4.
|
5
|
+
spec.version = '1.4.4'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.email = 'djberg96@gmail.com'
|
8
8
|
spec.homepage = 'https://github.com/djberg96/sys-filesystem'
|
@@ -16,14 +16,22 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.add_development_dependency('mkmf-lite', '~> 0.5') unless Gem.win_platform?
|
17
17
|
spec.add_development_dependency('rake')
|
18
18
|
spec.add_development_dependency('rspec', '~> 3.9')
|
19
|
+
spec.add_development_dependency('rubocop')
|
20
|
+
spec.add_development_dependency('rubocop-rspec')
|
21
|
+
|
22
|
+
if RUBY_PLATFORM == 'java' && Gem.win_platform?
|
23
|
+
spec.add_dependency('jruby-win32ole')
|
24
|
+
end
|
19
25
|
|
20
26
|
spec.metadata = {
|
21
|
-
'homepage_uri'
|
22
|
-
'bug_tracker_uri'
|
23
|
-
'changelog_uri'
|
24
|
-
'documentation_uri'
|
25
|
-
'source_code_uri'
|
26
|
-
'wiki_uri'
|
27
|
+
'homepage_uri' => 'https://github.com/djberg96/sys-filesystem',
|
28
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/sys-filesystem/issues',
|
29
|
+
'changelog_uri' => 'https://github.com/djberg96/sys-filesystem/blob/main/CHANGES.md',
|
30
|
+
'documentation_uri' => 'https://github.com/djberg96/sys-filesystem/wiki',
|
31
|
+
'source_code_uri' => 'https://github.com/djberg96/sys-filesystem',
|
32
|
+
'wiki_uri' => 'https://github.com/djberg96/sys-filesystem/wiki',
|
33
|
+
'rubygems_mfa_required' => 'true',
|
34
|
+
'github_repo' => 'https://github.com/djberg96/sys-filesystem'
|
27
35
|
}
|
28
36
|
|
29
37
|
spec.description = <<-EOF
|
data.tar.gz.sig
CHANGED
Binary file
|