pio 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce75fa3db348633f7c767002243b3622afbad27f
4
- data.tar.gz: 73ba0196a66d912c3b009e2aef354ef10c30bdbc
3
+ metadata.gz: 2f4f183d8a7d47bfd6ed73449452f65f0695e8fe
4
+ data.tar.gz: c184b79b8c5a2e8298caaa40e58d2be00434afa8
5
5
  SHA512:
6
- metadata.gz: e84a310f0f938dab183fa099e027a50f9f0642454fd1ed2d260b9185b3222ff0e3b28e59b7123526cfbfa74e3fd2c9f9b54691be30a1574c4096015d485dd5d3
7
- data.tar.gz: ceb22cf2e33db9a1dcc9183ccb73721a4052dc08d17a3191b3a000ed6ddfd1bf2a73567f4dc7f648db8c125236f2ca2f010b19caf8d277ff4f490e921ba3a80c
6
+ metadata.gz: 7a84124f47fc65aca6fbfc6edf702fd23b2231537154460c6d34ea93f8a075e2bba08b03c60f05e7c4a7919823b7c2c8f3eecee5f794945e8d997de550046848
7
+ data.tar.gz: 0a59da76fc8bbaa2d4bded717765876d52db4fd67e97e6b5b4839c4aac28db04afcaccc0f3219971d6b364e7069d707c24fce153b94bda3e963a62918caf2f46
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1 (6/5/2014)
4
+
5
+ ### Misc
6
+
7
+ * Updated bundled gems.
8
+ * Modernized Gemfile and .gemspec.
9
+
10
+
3
11
  ## 0.8.0 (5/26/2014)
4
12
 
5
13
  ### Changes
@@ -3,5 +3,5 @@
3
3
  # Base module.
4
4
  module Pio
5
5
  # gem version.
6
- VERSION = '0.8.0'.freeze
6
+ VERSION = '0.8.1'.freeze
7
7
  end
@@ -35,6 +35,36 @@ Gem::Specification.new do |gem|
35
35
  gem.test_files += Dir.glob('features/**/*')
36
36
 
37
37
  gem.required_ruby_version = '>= 1.9.3'
38
+
38
39
  gem.add_dependency 'bindata', '~> 2.1.0'
40
+
41
+ gem.add_development_dependency 'rake'
39
42
  gem.add_development_dependency 'bundler', '~> 1.6.2'
43
+ gem.add_development_dependency 'pry', '~> 0.9.12.6'
44
+
45
+ # Guard
46
+ gem.add_development_dependency 'guard', '~> 2.6.1'
47
+ gem.add_development_dependency 'guard-bundler', '~> 2.0.0'
48
+ gem.add_development_dependency 'guard-cucumber', '~> 1.4.1'
49
+ gem.add_development_dependency 'guard-rspec', '~> 4.2.9'
50
+ gem.add_development_dependency 'guard-rubocop', '~> 1.1.0'
51
+ gem.add_development_dependency 'rb-fchange', '~> 0.0.6'
52
+ gem.add_development_dependency 'rb-fsevent', '~> 0.9.4'
53
+ gem.add_development_dependency 'rb-inotify', '~> 0.9.3'
54
+ gem.add_development_dependency 'terminal-notifier-guard', '~> 1.5.3'
55
+
56
+ # Docs
57
+ gem.add_development_dependency 'inch', '~> 0.4.6'
58
+ gem.add_development_dependency 'yard', '~> 0.8.7.4'
59
+
60
+ # Test
61
+ gem.add_development_dependency 'codeclimate-test-reporter', '~> 0.3.0'
62
+ gem.add_development_dependency 'coveralls', '~> 0.7.0'
63
+ gem.add_development_dependency 'cucumber', '~> 1.3.15'
64
+ gem.add_development_dependency 'flay', '~> 2.5.0'
65
+ gem.add_development_dependency 'flog', '~> 4.2.1'
66
+ gem.add_development_dependency 'reek', '~> 1.3.7'
67
+ gem.add_development_dependency 'rspec', '~> 3.0.0'
68
+ gem.add_development_dependency 'rspec-given', '~> 3.5.4'
69
+ gem.add_development_dependency 'rubocop', '~> 0.23.0'
40
70
  end
@@ -118,41 +118,213 @@ describe Pio::Dhcp, '.read' do
118
118
  ]
119
119
  end
120
120
 
121
- its(:class) { should be Pio::Dhcp::Discover }
122
- its('destination_mac.to_s') { should eq 'ff:ff:ff:ff:ff:ff' }
123
- its('source_mac.to_s') { should eq '24:db:ac:41:e5:5b' }
124
- its(:ether_type) { should eq 2048 }
125
- its(:ip_version) { should eq 4 }
126
- its(:ip_header_length) { should eq 5 }
127
- its(:ip_type_of_service) { should eq 0 }
128
- its(:ip_total_length) { should eq 328 }
129
- its(:ip_identifier) { should eq 0x0000 }
130
- its(:ip_flag) { should eq 0 }
131
- its(:ip_fragment) { should eq 0 }
132
- its(:ip_ttl) { should eq 128 }
133
- its(:ip_protocol) { should eq 17 }
134
- its(:ip_header_checksum) { should eq 0x39a6 }
135
- its('ip_source_address.to_s') { should eq '0.0.0.0' }
136
- its('ip_destination_address.to_s') { should eq '255.255.255.255' }
137
- its(:udp_src_port) { should eq 68 }
138
- its(:udp_dst_port) { should eq 67 }
139
- its(:udp_length) { should eq 308 }
140
- its(:udp_checksum) { should eq 0x8814 }
141
- its(:message_type) { should eq 1 }
142
- its(:hw_addr_type) { should eq 1 }
143
- its(:hw_addr_len) { should eq 6 }
144
- its(:hops) { should eq 0 }
145
- its(:transaction_id) { should eq 0xdeadbeef }
146
- its(:seconds) { should eq 0 }
147
- its(:bootp_flags) { should eq 0 }
148
- its('client_ip_address.to_s') { should eq '0.0.0.0' }
149
- its('your_ip_address.to_s') { should eq '0.0.0.0' }
150
- its('next_server_ip_address.to_s') { should eq '0.0.0.0' }
151
- its('relay_agent_ip_address.to_s') { should eq '0.0.0.0' }
152
- its('client_mac_address.to_s') { should eq '24:db:ac:41:e5:5b' }
153
- its('client_identifier.to_s') { should eq '24:db:ac:41:e5:5b' }
154
- its('requested_ip_address.to_s') { should eq '0.0.0.0' }
155
- its(:parameters_list) { should eq [0x01, 0x03, 0x06, 0x2a] }
121
+ describe '#class' do
122
+ subject { super().class }
123
+ it { is_expected.to be Pio::Dhcp::Discover }
124
+ end
125
+
126
+ describe '#destination_mac' do
127
+ subject { super().destination_mac }
128
+ describe '#to_s' do
129
+ subject { super().to_s }
130
+ it { is_expected.to eq 'ff:ff:ff:ff:ff:ff' }
131
+ end
132
+ end
133
+
134
+ describe '#source_mac' do
135
+ subject { super().source_mac }
136
+ describe '#to_s' do
137
+ subject { super().to_s }
138
+ it { is_expected.to eq '24:db:ac:41:e5:5b' }
139
+ end
140
+ end
141
+
142
+ describe '#ether_type' do
143
+ subject { super().ether_type }
144
+ it { is_expected.to eq 2048 }
145
+ end
146
+
147
+ describe '#ip_version' do
148
+ subject { super().ip_version }
149
+ it { is_expected.to eq 4 }
150
+ end
151
+
152
+ describe '#ip_header_length' do
153
+ subject { super().ip_header_length }
154
+ it { is_expected.to eq 5 }
155
+ end
156
+
157
+ describe '#ip_type_of_service' do
158
+ subject { super().ip_type_of_service }
159
+ it { is_expected.to eq 0 }
160
+ end
161
+
162
+ describe '#ip_total_length' do
163
+ subject { super().ip_total_length }
164
+ it { is_expected.to eq 328 }
165
+ end
166
+
167
+ describe '#ip_identifier' do
168
+ subject { super().ip_identifier }
169
+ it { is_expected.to eq 0x0000 }
170
+ end
171
+
172
+ describe '#ip_flag' do
173
+ subject { super().ip_flag }
174
+ it { is_expected.to eq 0 }
175
+ end
176
+
177
+ describe '#ip_fragment' do
178
+ subject { super().ip_fragment }
179
+ it { is_expected.to eq 0 }
180
+ end
181
+
182
+ describe '#ip_ttl' do
183
+ subject { super().ip_ttl }
184
+ it { is_expected.to eq 128 }
185
+ end
186
+
187
+ describe '#ip_protocol' do
188
+ subject { super().ip_protocol }
189
+ it { is_expected.to eq 17 }
190
+ end
191
+
192
+ describe '#ip_header_checksum' do
193
+ subject { super().ip_header_checksum }
194
+ it { is_expected.to eq 0x39a6 }
195
+ end
196
+
197
+ describe '#ip_source_address' do
198
+ subject { super().ip_source_address }
199
+ describe '#to_s' do
200
+ subject { super().to_s }
201
+ it { is_expected.to eq '0.0.0.0' }
202
+ end
203
+ end
204
+
205
+ describe '#ip_destination_address' do
206
+ subject { super().ip_destination_address }
207
+ describe '#to_s' do
208
+ subject { super().to_s }
209
+ it { is_expected.to eq '255.255.255.255' }
210
+ end
211
+ end
212
+
213
+ describe '#udp_src_port' do
214
+ subject { super().udp_src_port }
215
+ it { is_expected.to eq 68 }
216
+ end
217
+
218
+ describe '#udp_dst_port' do
219
+ subject { super().udp_dst_port }
220
+ it { is_expected.to eq 67 }
221
+ end
222
+
223
+ describe '#udp_length' do
224
+ subject { super().udp_length }
225
+ it { is_expected.to eq 308 }
226
+ end
227
+
228
+ describe '#udp_checksum' do
229
+ subject { super().udp_checksum }
230
+ it { is_expected.to eq 0x8814 }
231
+ end
232
+
233
+ describe '#message_type' do
234
+ subject { super().message_type }
235
+ it { is_expected.to eq 1 }
236
+ end
237
+
238
+ describe '#hw_addr_type' do
239
+ subject { super().hw_addr_type }
240
+ it { is_expected.to eq 1 }
241
+ end
242
+
243
+ describe '#hw_addr_len' do
244
+ subject { super().hw_addr_len }
245
+ it { is_expected.to eq 6 }
246
+ end
247
+
248
+ describe '#hops' do
249
+ subject { super().hops }
250
+ it { is_expected.to eq 0 }
251
+ end
252
+
253
+ describe '#transaction_id' do
254
+ subject { super().transaction_id }
255
+ it { is_expected.to eq 0xdeadbeef }
256
+ end
257
+
258
+ describe '#seconds' do
259
+ subject { super().seconds }
260
+ it { is_expected.to eq 0 }
261
+ end
262
+
263
+ describe '#bootp_flags' do
264
+ subject { super().bootp_flags }
265
+ it { is_expected.to eq 0 }
266
+ end
267
+
268
+ describe '#client_ip_address' do
269
+ subject { super().client_ip_address }
270
+ describe '#to_s' do
271
+ subject { super().to_s }
272
+ it { is_expected.to eq '0.0.0.0' }
273
+ end
274
+ end
275
+
276
+ describe '#your_ip_address' do
277
+ subject { super().your_ip_address }
278
+ describe '#to_s' do
279
+ subject { super().to_s }
280
+ it { is_expected.to eq '0.0.0.0' }
281
+ end
282
+ end
283
+
284
+ describe '#next_server_ip_address' do
285
+ subject { super().next_server_ip_address }
286
+ describe '#to_s' do
287
+ subject { super().to_s }
288
+ it { is_expected.to eq '0.0.0.0' }
289
+ end
290
+ end
291
+
292
+ describe '#relay_agent_ip_address' do
293
+ subject { super().relay_agent_ip_address }
294
+ describe '#to_s' do
295
+ subject { super().to_s }
296
+ it { is_expected.to eq '0.0.0.0' }
297
+ end
298
+ end
299
+
300
+ describe '#client_mac_address' do
301
+ subject { super().client_mac_address }
302
+ describe '#to_s' do
303
+ subject { super().to_s }
304
+ it { is_expected.to eq '24:db:ac:41:e5:5b' }
305
+ end
306
+ end
307
+
308
+ describe '#client_identifier' do
309
+ subject { super().client_identifier }
310
+ describe '#to_s' do
311
+ subject { super().to_s }
312
+ it { is_expected.to eq '24:db:ac:41:e5:5b' }
313
+ end
314
+ end
315
+
316
+ describe '#requested_ip_address' do
317
+ subject { super().requested_ip_address }
318
+ describe '#to_s' do
319
+ subject { super().to_s }
320
+ it { is_expected.to eq '0.0.0.0' }
321
+ end
322
+ end
323
+
324
+ describe '#parameters_list' do
325
+ subject { super().parameters_list }
326
+ it { is_expected.to eq [0x01, 0x03, 0x06, 0x2a] }
327
+ end
156
328
  end
157
329
 
158
330
  context 'with DHCP offer frame' do
@@ -268,43 +440,223 @@ describe Pio::Dhcp, '.read' do
268
440
  ]
269
441
  end
270
442
 
271
- its(:class) { should be Pio::Dhcp::Offer }
272
- its('destination_mac.to_s') { should eq '11:22:33:44:55:66' }
273
- its('source_mac.to_s') { should eq 'aa:bb:cc:dd:ee:ff' }
274
- its(:ether_type) { should eq 2048 }
275
- its(:ip_version) { should eq 4 }
276
- its(:ip_header_length) { should eq 5 }
277
- its(:ip_type_of_service) { should eq 0 }
278
- its(:ip_total_length) { should eq 328 }
279
- its(:ip_identifier) { should eq 0x0000 }
280
- its(:ip_flag) { should eq 0 }
281
- its(:ip_fragment) { should eq 0 }
282
- its(:ip_ttl) { should eq 128 }
283
- its(:ip_protocol) { should eq 17 }
284
- its(:ip_header_checksum) { should eq 0xb849 }
285
- its('ip_source_address.to_s') { should eq '192.168.0.10' }
286
- its('ip_destination_address.to_s') { should eq '192.168.0.1' }
287
- its(:udp_src_port) { should eq 67 }
288
- its(:udp_dst_port) { should eq 68 }
289
- its(:udp_length) { should eq 308 }
290
- its(:udp_checksum) { should eq 7780 }
291
- its(:message_type) { should eq 2 }
292
- its(:hw_addr_type) { should eq 1 }
293
- its(:hw_addr_len) { should eq 6 }
294
- its(:hops) { should eq 0 }
295
- its(:transaction_id) { should eq 0xdeadbeef }
296
- its(:seconds) { should eq 0 }
297
- its(:bootp_flags) { should eq 0x0000 }
298
- its('client_ip_address.to_s') { should eq '0.0.0.0' }
299
- its('your_ip_address.to_s') { should eq '192.168.0.1' }
300
- its('next_server_ip_address.to_s') { should eq '0.0.0.0' }
301
- its('relay_agent_ip_address.to_s') { should eq '0.0.0.0' }
302
- its('client_mac_address.to_s') { should eq 'aa:bb:cc:dd:ee:ff' }
303
- its('server_identifier.to_s') { should eq '192.168.0.10' }
304
- its('subnet_mask.to_s') { should eq '255.255.255.0' }
305
- its(:renewal_time_value) { should eq 0xdeadbeef }
306
- its(:rebinding_time_value) { should eq 0xdeadbeef }
307
- its(:ip_address_lease_time) { should eq 0xdeadbeef }
443
+ describe '#class' do
444
+ subject { super().class }
445
+ it { is_expected.to be Pio::Dhcp::Offer }
446
+ end
447
+
448
+ describe '#destination_mac' do
449
+ subject { super().destination_mac }
450
+ describe '#to_s' do
451
+ subject { super().to_s }
452
+ it { is_expected.to eq '11:22:33:44:55:66' }
453
+ end
454
+ end
455
+
456
+ describe '#source_mac' do
457
+ subject { super().source_mac }
458
+ describe '#to_s' do
459
+ subject { super().to_s }
460
+ it { is_expected.to eq 'aa:bb:cc:dd:ee:ff' }
461
+ end
462
+ end
463
+
464
+ describe '#ether_type' do
465
+ subject { super().ether_type }
466
+ it { is_expected.to eq 2048 }
467
+ end
468
+
469
+ describe '#ip_version' do
470
+ subject { super().ip_version }
471
+ it { is_expected.to eq 4 }
472
+ end
473
+
474
+ describe '#ip_header_length' do
475
+ subject { super().ip_header_length }
476
+ it { is_expected.to eq 5 }
477
+ end
478
+
479
+ describe '#ip_type_of_service' do
480
+ subject { super().ip_type_of_service }
481
+ it { is_expected.to eq 0 }
482
+ end
483
+
484
+ describe '#ip_total_length' do
485
+ subject { super().ip_total_length }
486
+ it { is_expected.to eq 328 }
487
+ end
488
+
489
+ describe '#ip_identifier' do
490
+ subject { super().ip_identifier }
491
+ it { is_expected.to eq 0x0000 }
492
+ end
493
+
494
+ describe '#ip_flag' do
495
+ subject { super().ip_flag }
496
+ it { is_expected.to eq 0 }
497
+ end
498
+
499
+ describe '#ip_fragment' do
500
+ subject { super().ip_fragment }
501
+ it { is_expected.to eq 0 }
502
+ end
503
+
504
+ describe '#ip_ttl' do
505
+ subject { super().ip_ttl }
506
+ it { is_expected.to eq 128 }
507
+ end
508
+
509
+ describe '#ip_protocol' do
510
+ subject { super().ip_protocol }
511
+ it { is_expected.to eq 17 }
512
+ end
513
+
514
+ describe '#ip_header_checksum' do
515
+ subject { super().ip_header_checksum }
516
+ it { is_expected.to eq 0xb849 }
517
+ end
518
+
519
+ describe '#ip_source_address' do
520
+ subject { super().ip_source_address }
521
+ describe '#to_s' do
522
+ subject { super().to_s }
523
+ it { is_expected.to eq '192.168.0.10' }
524
+ end
525
+ end
526
+
527
+ describe '#ip_destination_address' do
528
+ subject { super().ip_destination_address }
529
+ describe '#to_s' do
530
+ subject { super().to_s }
531
+ it { is_expected.to eq '192.168.0.1' }
532
+ end
533
+ end
534
+
535
+ describe '#udp_src_port' do
536
+ subject { super().udp_src_port }
537
+ it { is_expected.to eq 67 }
538
+ end
539
+
540
+ describe '#udp_dst_port' do
541
+ subject { super().udp_dst_port }
542
+ it { is_expected.to eq 68 }
543
+ end
544
+
545
+ describe '#udp_length' do
546
+ subject { super().udp_length }
547
+ it { is_expected.to eq 308 }
548
+ end
549
+
550
+ describe '#udp_checksum' do
551
+ subject { super().udp_checksum }
552
+ it { is_expected.to eq 7780 }
553
+ end
554
+
555
+ describe '#message_type' do
556
+ subject { super().message_type }
557
+ it { is_expected.to eq 2 }
558
+ end
559
+
560
+ describe '#hw_addr_type' do
561
+ subject { super().hw_addr_type }
562
+ it { is_expected.to eq 1 }
563
+ end
564
+
565
+ describe '#hw_addr_len' do
566
+ subject { super().hw_addr_len }
567
+ it { is_expected.to eq 6 }
568
+ end
569
+
570
+ describe '#hops' do
571
+ subject { super().hops }
572
+ it { is_expected.to eq 0 }
573
+ end
574
+
575
+ describe '#transaction_id' do
576
+ subject { super().transaction_id }
577
+ it { is_expected.to eq 0xdeadbeef }
578
+ end
579
+
580
+ describe '#seconds' do
581
+ subject { super().seconds }
582
+ it { is_expected.to eq 0 }
583
+ end
584
+
585
+ describe '#bootp_flags' do
586
+ subject { super().bootp_flags }
587
+ it { is_expected.to eq 0x0000 }
588
+ end
589
+
590
+ describe '#client_ip_address' do
591
+ subject { super().client_ip_address }
592
+ describe '#to_s' do
593
+ subject { super().to_s }
594
+ it { is_expected.to eq '0.0.0.0' }
595
+ end
596
+ end
597
+
598
+ describe '#your_ip_address' do
599
+ subject { super().your_ip_address }
600
+ describe '#to_s' do
601
+ subject { super().to_s }
602
+ it { is_expected.to eq '192.168.0.1' }
603
+ end
604
+ end
605
+
606
+ describe '#next_server_ip_address' do
607
+ subject { super().next_server_ip_address }
608
+ describe '#to_s' do
609
+ subject { super().to_s }
610
+ it { is_expected.to eq '0.0.0.0' }
611
+ end
612
+ end
613
+
614
+ describe '#relay_agent_ip_address' do
615
+ subject { super().relay_agent_ip_address }
616
+ describe '#to_s' do
617
+ subject { super().to_s }
618
+ it { is_expected.to eq '0.0.0.0' }
619
+ end
620
+ end
621
+
622
+ describe '#client_mac_address' do
623
+ subject { super().client_mac_address }
624
+ describe '#to_s' do
625
+ subject { super().to_s }
626
+ it { is_expected.to eq 'aa:bb:cc:dd:ee:ff' }
627
+ end
628
+ end
629
+
630
+ describe '#server_identifier' do
631
+ subject { super().server_identifier }
632
+ describe '#to_s' do
633
+ subject { super().to_s }
634
+ it { is_expected.to eq '192.168.0.10' }
635
+ end
636
+ end
637
+
638
+ describe '#subnet_mask' do
639
+ subject { super().subnet_mask }
640
+ describe '#to_s' do
641
+ subject { super().to_s }
642
+ it { is_expected.to eq '255.255.255.0' }
643
+ end
644
+ end
645
+
646
+ describe '#renewal_time_value' do
647
+ subject { super().renewal_time_value }
648
+ it { is_expected.to eq 0xdeadbeef }
649
+ end
650
+
651
+ describe '#rebinding_time_value' do
652
+ subject { super().rebinding_time_value }
653
+ it { is_expected.to eq 0xdeadbeef }
654
+ end
655
+
656
+ describe '#ip_address_lease_time' do
657
+ subject { super().ip_address_lease_time }
658
+ it { is_expected.to eq 0xdeadbeef }
659
+ end
308
660
  end
309
661
 
310
662
  context 'with DHCP Request frame' do
@@ -418,41 +770,213 @@ describe Pio::Dhcp, '.read' do
418
770
  ]
419
771
  end
420
772
 
421
- its(:class) { should be Pio::Dhcp::Request }
422
- its('destination_mac.to_s') { should eq 'ff:ff:ff:ff:ff:ff' }
423
- its('source_mac.to_s') { should eq '24:db:ac:41:e5:5b' }
424
- its(:ether_type) { should eq 2048 }
425
- its(:ip_version) { should eq 4 }
426
- its(:ip_header_length) { should eq 5 }
427
- its(:ip_type_of_service) { should eq 0 }
428
- its(:ip_total_length) { should eq 328 }
429
- its(:ip_identifier) { should eq 0x0000 }
430
- its(:ip_flag) { should eq 0 }
431
- its(:ip_fragment) { should eq 0 }
432
- its(:ip_ttl) { should eq 128 }
433
- its(:ip_protocol) { should eq 17 }
434
- its(:ip_header_checksum) { should eq 0x39a6 }
435
- its('ip_source_address.to_s') { should eq '0.0.0.0' }
436
- its('ip_destination_address.to_s') { should eq '255.255.255.255' }
437
- its(:udp_src_port) { should eq 68 }
438
- its(:udp_dst_port) { should eq 67 }
439
- its(:udp_length) { should eq 308 }
440
- its(:udp_checksum) { should eq 0xceb3 }
441
- its(:message_type) { should eq 3 }
442
- its(:hw_addr_type) { should eq 1 }
443
- its(:hw_addr_len) { should eq 6 }
444
- its(:hops) { should eq 0 }
445
- its(:transaction_id) { should eq 0xdeadbeef }
446
- its(:seconds) { should eq 0 }
447
- its(:bootp_flags) { should eq 0 }
448
- its('client_ip_address.to_s') { should eq '0.0.0.0' }
449
- its('your_ip_address.to_s') { should eq '0.0.0.0' }
450
- its('next_server_ip_address.to_s') { should eq '0.0.0.0' }
451
- its('relay_agent_ip_address.to_s') { should eq '0.0.0.0' }
452
- its('client_mac_address.to_s') { should eq '24:db:ac:41:e5:5b' }
453
- its('client_identifier.to_s') { should eq '24:db:ac:41:e5:5b' }
454
- its('requested_ip_address.to_s') { should eq '192.168.0.10' }
455
- its(:parameters_list) { should eq [0x01, 0x03, 0x06, 0x2a] }
773
+ describe '#class' do
774
+ subject { super().class }
775
+ it { is_expected.to be Pio::Dhcp::Request }
776
+ end
777
+
778
+ describe '#destination_mac' do
779
+ subject { super().destination_mac }
780
+ describe '#to_s' do
781
+ subject { super().to_s }
782
+ it { is_expected.to eq 'ff:ff:ff:ff:ff:ff' }
783
+ end
784
+ end
785
+
786
+ describe '#source_mac' do
787
+ subject { super().source_mac }
788
+ describe '#to_s' do
789
+ subject { super().to_s }
790
+ it { is_expected.to eq '24:db:ac:41:e5:5b' }
791
+ end
792
+ end
793
+
794
+ describe '#ether_type' do
795
+ subject { super().ether_type }
796
+ it { is_expected.to eq 2048 }
797
+ end
798
+
799
+ describe '#ip_version' do
800
+ subject { super().ip_version }
801
+ it { is_expected.to eq 4 }
802
+ end
803
+
804
+ describe '#ip_header_length' do
805
+ subject { super().ip_header_length }
806
+ it { is_expected.to eq 5 }
807
+ end
808
+
809
+ describe '#ip_type_of_service' do
810
+ subject { super().ip_type_of_service }
811
+ it { is_expected.to eq 0 }
812
+ end
813
+
814
+ describe '#ip_total_length' do
815
+ subject { super().ip_total_length }
816
+ it { is_expected.to eq 328 }
817
+ end
818
+
819
+ describe '#ip_identifier' do
820
+ subject { super().ip_identifier }
821
+ it { is_expected.to eq 0x0000 }
822
+ end
823
+
824
+ describe '#ip_flag' do
825
+ subject { super().ip_flag }
826
+ it { is_expected.to eq 0 }
827
+ end
828
+
829
+ describe '#ip_fragment' do
830
+ subject { super().ip_fragment }
831
+ it { is_expected.to eq 0 }
832
+ end
833
+
834
+ describe '#ip_ttl' do
835
+ subject { super().ip_ttl }
836
+ it { is_expected.to eq 128 }
837
+ end
838
+
839
+ describe '#ip_protocol' do
840
+ subject { super().ip_protocol }
841
+ it { is_expected.to eq 17 }
842
+ end
843
+
844
+ describe '#ip_header_checksum' do
845
+ subject { super().ip_header_checksum }
846
+ it { is_expected.to eq 0x39a6 }
847
+ end
848
+
849
+ describe '#ip_source_address' do
850
+ subject { super().ip_source_address }
851
+ describe '#to_s' do
852
+ subject { super().to_s }
853
+ it { is_expected.to eq '0.0.0.0' }
854
+ end
855
+ end
856
+
857
+ describe '#ip_destination_address' do
858
+ subject { super().ip_destination_address }
859
+ describe '#to_s' do
860
+ subject { super().to_s }
861
+ it { is_expected.to eq '255.255.255.255' }
862
+ end
863
+ end
864
+
865
+ describe '#udp_src_port' do
866
+ subject { super().udp_src_port }
867
+ it { is_expected.to eq 68 }
868
+ end
869
+
870
+ describe '#udp_dst_port' do
871
+ subject { super().udp_dst_port }
872
+ it { is_expected.to eq 67 }
873
+ end
874
+
875
+ describe '#udp_length' do
876
+ subject { super().udp_length }
877
+ it { is_expected.to eq 308 }
878
+ end
879
+
880
+ describe '#udp_checksum' do
881
+ subject { super().udp_checksum }
882
+ it { is_expected.to eq 0xceb3 }
883
+ end
884
+
885
+ describe '#message_type' do
886
+ subject { super().message_type }
887
+ it { is_expected.to eq 3 }
888
+ end
889
+
890
+ describe '#hw_addr_type' do
891
+ subject { super().hw_addr_type }
892
+ it { is_expected.to eq 1 }
893
+ end
894
+
895
+ describe '#hw_addr_len' do
896
+ subject { super().hw_addr_len }
897
+ it { is_expected.to eq 6 }
898
+ end
899
+
900
+ describe '#hops' do
901
+ subject { super().hops }
902
+ it { is_expected.to eq 0 }
903
+ end
904
+
905
+ describe '#transaction_id' do
906
+ subject { super().transaction_id }
907
+ it { is_expected.to eq 0xdeadbeef }
908
+ end
909
+
910
+ describe '#seconds' do
911
+ subject { super().seconds }
912
+ it { is_expected.to eq 0 }
913
+ end
914
+
915
+ describe '#bootp_flags' do
916
+ subject { super().bootp_flags }
917
+ it { is_expected.to eq 0 }
918
+ end
919
+
920
+ describe '#client_ip_address' do
921
+ subject { super().client_ip_address }
922
+ describe '#to_s' do
923
+ subject { super().to_s }
924
+ it { is_expected.to eq '0.0.0.0' }
925
+ end
926
+ end
927
+
928
+ describe '#your_ip_address' do
929
+ subject { super().your_ip_address }
930
+ describe '#to_s' do
931
+ subject { super().to_s }
932
+ it { is_expected.to eq '0.0.0.0' }
933
+ end
934
+ end
935
+
936
+ describe '#next_server_ip_address' do
937
+ subject { super().next_server_ip_address }
938
+ describe '#to_s' do
939
+ subject { super().to_s }
940
+ it { is_expected.to eq '0.0.0.0' }
941
+ end
942
+ end
943
+
944
+ describe '#relay_agent_ip_address' do
945
+ subject { super().relay_agent_ip_address }
946
+ describe '#to_s' do
947
+ subject { super().to_s }
948
+ it { is_expected.to eq '0.0.0.0' }
949
+ end
950
+ end
951
+
952
+ describe '#client_mac_address' do
953
+ subject { super().client_mac_address }
954
+ describe '#to_s' do
955
+ subject { super().to_s }
956
+ it { is_expected.to eq '24:db:ac:41:e5:5b' }
957
+ end
958
+ end
959
+
960
+ describe '#client_identifier' do
961
+ subject { super().client_identifier }
962
+ describe '#to_s' do
963
+ subject { super().to_s }
964
+ it { is_expected.to eq '24:db:ac:41:e5:5b' }
965
+ end
966
+ end
967
+
968
+ describe '#requested_ip_address' do
969
+ subject { super().requested_ip_address }
970
+ describe '#to_s' do
971
+ subject { super().to_s }
972
+ it { is_expected.to eq '192.168.0.10' }
973
+ end
974
+ end
975
+
976
+ describe '#parameters_list' do
977
+ subject { super().parameters_list }
978
+ it { is_expected.to eq [0x01, 0x03, 0x06, 0x2a] }
979
+ end
456
980
  end
457
981
 
458
982
  context 'with DHCP ACK frame' do
@@ -568,42 +1092,222 @@ describe Pio::Dhcp, '.read' do
568
1092
  ]
569
1093
  end
570
1094
 
571
- its(:class) { should be Pio::Dhcp::Ack }
572
- its('destination_mac.to_s') { should eq '11:22:33:44:55:66' }
573
- its('source_mac.to_s') { should eq 'aa:bb:cc:dd:ee:ff' }
574
- its(:ether_type) { should eq 2048 }
575
- its(:ip_version) { should eq 4 }
576
- its(:ip_header_length) { should eq 5 }
577
- its(:ip_type_of_service) { should eq 0 }
578
- its(:ip_total_length) { should eq 328 }
579
- its(:ip_identifier) { should eq 0x0000 }
580
- its(:ip_flag) { should eq 0 }
581
- its(:ip_fragment) { should eq 0 }
582
- its(:ip_ttl) { should eq 128 }
583
- its(:ip_protocol) { should eq 17 }
584
- its(:ip_header_checksum) { should eq 0xb849 }
585
- its('ip_source_address.to_s') { should eq '192.168.0.10' }
586
- its('ip_destination_address.to_s') { should eq '192.168.0.1' }
587
- its(:udp_src_port) { should eq 67 }
588
- its(:udp_dst_port) { should eq 68 }
589
- its(:udp_length) { should eq 308 }
590
- its(:udp_checksum) { should eq 0x1b64 }
591
- its(:message_type) { should eq 5 }
592
- its(:hw_addr_type) { should eq 1 }
593
- its(:hw_addr_len) { should eq 6 }
594
- its(:hops) { should eq 0 }
595
- its(:transaction_id) { should eq 0xdeadbeef }
596
- its(:seconds) { should eq 0 }
597
- its(:bootp_flags) { should eq 0x0000 }
598
- its('client_ip_address.to_s') { should eq '0.0.0.0' }
599
- its('your_ip_address.to_s') { should eq '192.168.0.1' }
600
- its('next_server_ip_address.to_s') { should eq '0.0.0.0' }
601
- its('relay_agent_ip_address.to_s') { should eq '0.0.0.0' }
602
- its('client_mac_address.to_s') { should eq 'aa:bb:cc:dd:ee:ff' }
603
- its('server_identifier.to_s') { should eq '192.168.0.10' }
604
- its('subnet_mask.to_s') { should eq '255.255.255.0' }
605
- its(:renewal_time_value) { should eq 0xdeadbeef }
606
- its(:rebinding_time_value) { should eq 0xdeadbeef }
607
- its(:ip_address_lease_time) { should eq 0xdeadbeef }
1095
+ describe '#class' do
1096
+ subject { super().class }
1097
+ it { is_expected.to be Pio::Dhcp::Ack }
1098
+ end
1099
+
1100
+ describe '#destination_mac' do
1101
+ subject { super().destination_mac }
1102
+ describe '#to_s' do
1103
+ subject { super().to_s }
1104
+ it { is_expected.to eq '11:22:33:44:55:66' }
1105
+ end
1106
+ end
1107
+
1108
+ describe '#source_mac' do
1109
+ subject { super().source_mac }
1110
+ describe '#to_s' do
1111
+ subject { super().to_s }
1112
+ it { is_expected.to eq 'aa:bb:cc:dd:ee:ff' }
1113
+ end
1114
+ end
1115
+
1116
+ describe '#ether_type' do
1117
+ subject { super().ether_type }
1118
+ it { is_expected.to eq 2048 }
1119
+ end
1120
+
1121
+ describe '#ip_version' do
1122
+ subject { super().ip_version }
1123
+ it { is_expected.to eq 4 }
1124
+ end
1125
+
1126
+ describe '#ip_header_length' do
1127
+ subject { super().ip_header_length }
1128
+ it { is_expected.to eq 5 }
1129
+ end
1130
+
1131
+ describe '#ip_type_of_service' do
1132
+ subject { super().ip_type_of_service }
1133
+ it { is_expected.to eq 0 }
1134
+ end
1135
+
1136
+ describe '#ip_total_length' do
1137
+ subject { super().ip_total_length }
1138
+ it { is_expected.to eq 328 }
1139
+ end
1140
+
1141
+ describe '#ip_identifier' do
1142
+ subject { super().ip_identifier }
1143
+ it { is_expected.to eq 0x0000 }
1144
+ end
1145
+
1146
+ describe '#ip_flag' do
1147
+ subject { super().ip_flag }
1148
+ it { is_expected.to eq 0 }
1149
+ end
1150
+
1151
+ describe '#ip_fragment' do
1152
+ subject { super().ip_fragment }
1153
+ it { is_expected.to eq 0 }
1154
+ end
1155
+
1156
+ describe '#ip_ttl' do
1157
+ subject { super().ip_ttl }
1158
+ it { is_expected.to eq 128 }
1159
+ end
1160
+
1161
+ describe '#ip_protocol' do
1162
+ subject { super().ip_protocol }
1163
+ it { is_expected.to eq 17 }
1164
+ end
1165
+
1166
+ describe '#ip_header_checksum' do
1167
+ subject { super().ip_header_checksum }
1168
+ it { is_expected.to eq 0xb849 }
1169
+ end
1170
+
1171
+ describe '#ip_source_address' do
1172
+ subject { super().ip_source_address }
1173
+ describe '#to_s' do
1174
+ subject { super().to_s }
1175
+ it { is_expected.to eq '192.168.0.10' }
1176
+ end
1177
+ end
1178
+
1179
+ describe '#ip_destination_address' do
1180
+ subject { super().ip_destination_address }
1181
+ describe '#to_s' do
1182
+ subject { super().to_s }
1183
+ it { is_expected.to eq '192.168.0.1' }
1184
+ end
1185
+ end
1186
+
1187
+ describe '#udp_src_port' do
1188
+ subject { super().udp_src_port }
1189
+ it { is_expected.to eq 67 }
1190
+ end
1191
+
1192
+ describe '#udp_dst_port' do
1193
+ subject { super().udp_dst_port }
1194
+ it { is_expected.to eq 68 }
1195
+ end
1196
+
1197
+ describe '#udp_length' do
1198
+ subject { super().udp_length }
1199
+ it { is_expected.to eq 308 }
1200
+ end
1201
+
1202
+ describe '#udp_checksum' do
1203
+ subject { super().udp_checksum }
1204
+ it { is_expected.to eq 0x1b64 }
1205
+ end
1206
+
1207
+ describe '#message_type' do
1208
+ subject { super().message_type }
1209
+ it { is_expected.to eq 5 }
1210
+ end
1211
+
1212
+ describe '#hw_addr_type' do
1213
+ subject { super().hw_addr_type }
1214
+ it { is_expected.to eq 1 }
1215
+ end
1216
+
1217
+ describe '#hw_addr_len' do
1218
+ subject { super().hw_addr_len }
1219
+ it { is_expected.to eq 6 }
1220
+ end
1221
+
1222
+ describe '#hops' do
1223
+ subject { super().hops }
1224
+ it { is_expected.to eq 0 }
1225
+ end
1226
+
1227
+ describe '#transaction_id' do
1228
+ subject { super().transaction_id }
1229
+ it { is_expected.to eq 0xdeadbeef }
1230
+ end
1231
+
1232
+ describe '#seconds' do
1233
+ subject { super().seconds }
1234
+ it { is_expected.to eq 0 }
1235
+ end
1236
+
1237
+ describe '#bootp_flags' do
1238
+ subject { super().bootp_flags }
1239
+ it { is_expected.to eq 0x0000 }
1240
+ end
1241
+
1242
+ describe '#client_ip_address' do
1243
+ subject { super().client_ip_address }
1244
+ describe '#to_s' do
1245
+ subject { super().to_s }
1246
+ it { is_expected.to eq '0.0.0.0' }
1247
+ end
1248
+ end
1249
+
1250
+ describe '#your_ip_address' do
1251
+ subject { super().your_ip_address }
1252
+ describe '#to_s' do
1253
+ subject { super().to_s }
1254
+ it { is_expected.to eq '192.168.0.1' }
1255
+ end
1256
+ end
1257
+
1258
+ describe '#next_server_ip_address' do
1259
+ subject { super().next_server_ip_address }
1260
+ describe '#to_s' do
1261
+ subject { super().to_s }
1262
+ it { is_expected.to eq '0.0.0.0' }
1263
+ end
1264
+ end
1265
+
1266
+ describe '#relay_agent_ip_address' do
1267
+ subject { super().relay_agent_ip_address }
1268
+ describe '#to_s' do
1269
+ subject { super().to_s }
1270
+ it { is_expected.to eq '0.0.0.0' }
1271
+ end
1272
+ end
1273
+
1274
+ describe '#client_mac_address' do
1275
+ subject { super().client_mac_address }
1276
+ describe '#to_s' do
1277
+ subject { super().to_s }
1278
+ it { is_expected.to eq 'aa:bb:cc:dd:ee:ff' }
1279
+ end
1280
+ end
1281
+
1282
+ describe '#server_identifier' do
1283
+ subject { super().server_identifier }
1284
+ describe '#to_s' do
1285
+ subject { super().to_s }
1286
+ it { is_expected.to eq '192.168.0.10' }
1287
+ end
1288
+ end
1289
+
1290
+ describe '#subnet_mask' do
1291
+ subject { super().subnet_mask }
1292
+ describe '#to_s' do
1293
+ subject { super().to_s }
1294
+ it { is_expected.to eq '255.255.255.0' }
1295
+ end
1296
+ end
1297
+
1298
+ describe '#renewal_time_value' do
1299
+ subject { super().renewal_time_value }
1300
+ it { is_expected.to eq 0xdeadbeef }
1301
+ end
1302
+
1303
+ describe '#rebinding_time_value' do
1304
+ subject { super().rebinding_time_value }
1305
+ it { is_expected.to eq 0xdeadbeef }
1306
+ end
1307
+
1308
+ describe '#ip_address_lease_time' do
1309
+ subject { super().ip_address_lease_time }
1310
+ it { is_expected.to eq 0xdeadbeef }
1311
+ end
608
1312
  end
609
1313
  end