metasploit-model 0.30.0-java → 0.30.1-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +2 -4
- data/Gemfile +1 -6
- data/lib/metasploit/model/version.rb +1 -1
- data/spec/app/models/metasploit/model/association/reflection_spec.rb +5 -7
- data/spec/app/models/metasploit/model/search/group/base_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/group/union_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/association_spec.rb +7 -9
- data/spec/app/models/metasploit/model/search/operation/base_spec.rb +5 -7
- data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +14 -11
- data/spec/app/models/metasploit/model/search/operation/date_spec.rb +6 -8
- data/spec/app/models/metasploit/model/search/operation/group/base_spec.rb +12 -14
- data/spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/group/union_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/null_spec.rb +4 -6
- data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/set_spec.rb +4 -6
- data/spec/app/models/metasploit/model/search/operation/string_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operator/association_spec.rb +6 -8
- data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +12 -14
- data/spec/app/models/metasploit/model/search/operator/base_spec.rb +3 -5
- data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +13 -11
- data/spec/app/models/metasploit/model/search/operator/group/base_spec.rb +5 -7
- data/spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb +3 -5
- data/spec/app/models/metasploit/model/search/operator/group/union_spec.rb +3 -5
- data/spec/app/models/metasploit/model/search/operator/null_spec.rb +5 -7
- data/spec/app/models/metasploit/model/search/operator/single_spec.rb +26 -28
- data/spec/app/models/metasploit/model/search/query_spec.rb +48 -50
- data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +7 -9
- data/spec/app/validators/ip_format_validator_spec.rb +7 -9
- data/spec/app/validators/nil_validator_spec.rb +3 -5
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +17 -19
- data/spec/lib/metasploit/model/association/error_spec.rb +1 -3
- data/spec/lib/metasploit/model/association_spec.rb +8 -10
- data/spec/lib/metasploit/model/base_spec.rb +3 -5
- data/spec/lib/metasploit/model/engine_spec.rb +48 -11
- data/spec/lib/metasploit/model/file_spec.rb +3 -5
- data/spec/lib/metasploit/model/invalid_spec.rb +7 -9
- data/spec/lib/metasploit/model/login/status_spec.rb +1 -3
- data/spec/lib/metasploit/model/nilify_blanks_spec.rb +11 -13
- data/spec/lib/metasploit/model/realm/key_spec.rb +15 -17
- data/spec/lib/metasploit/model/search/association/tree_spec.rb +3 -5
- data/spec/lib/metasploit/model/search/association_spec.rb +2 -4
- data/spec/lib/metasploit/model/search/attribute_spec.rb +6 -8
- data/spec/lib/metasploit/model/search/operation/value/integer_spec.rb +1 -3
- data/spec/lib/metasploit/model/search/operation/value/string_spec.rb +1 -3
- data/spec/lib/metasploit/model/search/operation_spec.rb +11 -13
- data/spec/lib/metasploit/model/search/operator/help_spec.rb +1 -3
- data/spec/lib/metasploit/model/search/with_spec.rb +7 -9
- data/spec/lib/metasploit/model/search_spec.rb +11 -13
- data/spec/lib/metasploit/model/spec/error_spec.rb +2 -4
- data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +5 -7
- data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +4 -6
- data/spec/lib/metasploit/model/spec_spec.rb +9 -7
- data/spec/lib/metasploit/model/translation_spec.rb +10 -12
- data/spec/lib/metasploit/model/version_spec.rb +3 -5
- data/spec/lib/metasploit/model/visitation/visit_spec.rb +28 -26
- data/spec/matchers/validate_nilness_of_spec.rb +0 -2
- data/spec/spec_helper.rb +69 -7
- data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +1 -1
- data/spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb +8 -8
- data/spec/support/shared/examples/metasploit/model/search/operation/value/string.rb +5 -5
- data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +18 -16
- data/spec/support/shared/examples/metasploit/model/translation.rb +4 -4
- data/spec/support/shared/examples/search/query.rb +3 -3
- data/spec/support/shared/examples/search_association.rb +2 -2
- data/spec/support/shared/examples/search_attribute.rb +3 -3
- data/spec/support/shared/examples/search_with.rb +3 -3
- metadata +2 -2
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
describe Metasploit::Model::Search::Query do
|
|
1
|
+
RSpec.describe Metasploit::Model::Search::Query, type: :model do
|
|
4
2
|
context 'validations' do
|
|
5
|
-
it {
|
|
3
|
+
it { is_expected.to validate_presence_of :klass }
|
|
6
4
|
|
|
7
5
|
context 'operations' do
|
|
8
6
|
let(:errors) do
|
|
@@ -45,11 +43,11 @@ describe Metasploit::Model::Search::Query do
|
|
|
45
43
|
end
|
|
46
44
|
|
|
47
45
|
it 'should have no operations' do
|
|
48
|
-
query.operations.length.
|
|
46
|
+
expect(query.operations.length).to eq(0)
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
it 'should record error on operations' do
|
|
52
|
-
errors.
|
|
50
|
+
expect(errors).to include(error)
|
|
53
51
|
end
|
|
54
52
|
end
|
|
55
53
|
|
|
@@ -59,7 +57,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
59
57
|
end
|
|
60
58
|
|
|
61
59
|
it 'should not record error on operations' do
|
|
62
|
-
errors.
|
|
60
|
+
expect(errors).not_to include(error)
|
|
63
61
|
end
|
|
64
62
|
end
|
|
65
63
|
end
|
|
@@ -75,7 +73,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
75
73
|
|
|
76
74
|
before(:each) do
|
|
77
75
|
operation = double('Invalid Operation', :valid? => valid)
|
|
78
|
-
query.
|
|
76
|
+
allow(query).to receive(:operations).and_return([operation])
|
|
79
77
|
end
|
|
80
78
|
|
|
81
79
|
context 'with invalid operation' do
|
|
@@ -84,7 +82,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
84
82
|
end
|
|
85
83
|
|
|
86
84
|
it 'should record error on operations' do
|
|
87
|
-
errors.
|
|
85
|
+
expect(errors).not_to include(error)
|
|
88
86
|
end
|
|
89
87
|
end
|
|
90
88
|
|
|
@@ -94,7 +92,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
94
92
|
end
|
|
95
93
|
|
|
96
94
|
it 'should not record error on options' do
|
|
97
|
-
errors.
|
|
95
|
+
expect(errors).not_to include(error)
|
|
98
96
|
end
|
|
99
97
|
end
|
|
100
98
|
end
|
|
@@ -117,11 +115,11 @@ describe Metasploit::Model::Search::Query do
|
|
|
117
115
|
end
|
|
118
116
|
|
|
119
117
|
it 'should include operation with space in value' do
|
|
120
|
-
formatted_operations.
|
|
118
|
+
expect(formatted_operations).to include('formatted_operator1:formatted value:1')
|
|
121
119
|
end
|
|
122
120
|
|
|
123
121
|
it 'should include operation without space in value' do
|
|
124
|
-
formatted_operations.
|
|
122
|
+
expect(formatted_operations).to include('formatted_operator2:formatted_value2')
|
|
125
123
|
end
|
|
126
124
|
end
|
|
127
125
|
|
|
@@ -172,7 +170,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
172
170
|
end
|
|
173
171
|
|
|
174
172
|
it 'should equal attribute passed to #initialize' do
|
|
175
|
-
formatted_operations.
|
|
173
|
+
expect(formatted_operations).to eq(expected_formatted_operations)
|
|
176
174
|
end
|
|
177
175
|
end
|
|
178
176
|
|
|
@@ -208,7 +206,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
208
206
|
end
|
|
209
207
|
|
|
210
208
|
it 'should parse #formatted with formatted_operations' do
|
|
211
|
-
described_class.
|
|
209
|
+
expect(described_class).to receive(:formatted_operations).with(formatted).and_return([])
|
|
212
210
|
|
|
213
211
|
formatted_operations
|
|
214
212
|
end
|
|
@@ -232,7 +230,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
232
230
|
end
|
|
233
231
|
|
|
234
232
|
it 'should use attribute passed to #initialize' do
|
|
235
|
-
operations.
|
|
233
|
+
expect(operations).to eq(expected_operations)
|
|
236
234
|
end
|
|
237
235
|
end
|
|
238
236
|
|
|
@@ -272,7 +270,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
272
270
|
end
|
|
273
271
|
|
|
274
272
|
it 'should call #formatted_operations' do
|
|
275
|
-
query.
|
|
273
|
+
expect(query).to receive(:formatted_operations).and_return([])
|
|
276
274
|
|
|
277
275
|
operations
|
|
278
276
|
end
|
|
@@ -299,14 +297,14 @@ describe Metasploit::Model::Search::Query do
|
|
|
299
297
|
:boolean
|
|
300
298
|
end
|
|
301
299
|
|
|
302
|
-
it {
|
|
300
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operation::Boolean }
|
|
303
301
|
|
|
304
302
|
context "with 'true'" do
|
|
305
303
|
let(:formatted_value) do
|
|
306
304
|
'true'
|
|
307
305
|
end
|
|
308
306
|
|
|
309
|
-
it {
|
|
307
|
+
it { is_expected.to be_valid }
|
|
310
308
|
end
|
|
311
309
|
|
|
312
310
|
context "with 'false'" do
|
|
@@ -314,7 +312,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
314
312
|
'false'
|
|
315
313
|
end
|
|
316
314
|
|
|
317
|
-
it {
|
|
315
|
+
it { is_expected.to be_valid }
|
|
318
316
|
end
|
|
319
317
|
|
|
320
318
|
context "without 'false' or 'true'" do
|
|
@@ -322,7 +320,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
322
320
|
'no'
|
|
323
321
|
end
|
|
324
322
|
|
|
325
|
-
it {
|
|
323
|
+
it { is_expected.to_not be_valid }
|
|
326
324
|
end
|
|
327
325
|
end
|
|
328
326
|
|
|
@@ -331,14 +329,14 @@ describe Metasploit::Model::Search::Query do
|
|
|
331
329
|
:date
|
|
332
330
|
end
|
|
333
331
|
|
|
334
|
-
it {
|
|
332
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operation::Date }
|
|
335
333
|
|
|
336
334
|
context 'with date' do
|
|
337
335
|
let(:formatted_value) do
|
|
338
336
|
Date.today.to_s
|
|
339
337
|
end
|
|
340
338
|
|
|
341
|
-
it {
|
|
339
|
+
it { is_expected.to be_valid }
|
|
342
340
|
end
|
|
343
341
|
|
|
344
342
|
context 'without date' do
|
|
@@ -346,7 +344,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
346
344
|
'yesterday'
|
|
347
345
|
end
|
|
348
346
|
|
|
349
|
-
it {
|
|
347
|
+
it { is_expected.to_not be_valid }
|
|
350
348
|
end
|
|
351
349
|
end
|
|
352
350
|
|
|
@@ -355,14 +353,14 @@ describe Metasploit::Model::Search::Query do
|
|
|
355
353
|
:integer
|
|
356
354
|
end
|
|
357
355
|
|
|
358
|
-
it {
|
|
356
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operation::Integer }
|
|
359
357
|
|
|
360
358
|
context 'with integer' do
|
|
361
359
|
let(:formatted_value) do
|
|
362
360
|
'100'
|
|
363
361
|
end
|
|
364
362
|
|
|
365
|
-
it {
|
|
363
|
+
it { is_expected.to be_valid }
|
|
366
364
|
end
|
|
367
365
|
|
|
368
366
|
context 'with float' do
|
|
@@ -370,7 +368,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
370
368
|
'100.5'
|
|
371
369
|
end
|
|
372
370
|
|
|
373
|
-
it {
|
|
371
|
+
it { is_expected.to be_invalid }
|
|
374
372
|
end
|
|
375
373
|
|
|
376
374
|
context 'with integer embedded in text' do
|
|
@@ -378,7 +376,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
378
376
|
'a2c'
|
|
379
377
|
end
|
|
380
378
|
|
|
381
|
-
it {
|
|
379
|
+
it { is_expected.to be_invalid }
|
|
382
380
|
end
|
|
383
381
|
end
|
|
384
382
|
|
|
@@ -387,14 +385,14 @@ describe Metasploit::Model::Search::Query do
|
|
|
387
385
|
:string
|
|
388
386
|
end
|
|
389
387
|
|
|
390
|
-
it {
|
|
388
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operation::String }
|
|
391
389
|
|
|
392
390
|
context 'with value' do
|
|
393
391
|
let(:formatted_value) do
|
|
394
392
|
'formatted_value'
|
|
395
393
|
end
|
|
396
394
|
|
|
397
|
-
it {
|
|
395
|
+
it { is_expected.to be_valid }
|
|
398
396
|
end
|
|
399
397
|
|
|
400
398
|
context 'without value' do
|
|
@@ -402,7 +400,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
402
400
|
''
|
|
403
401
|
end
|
|
404
402
|
|
|
405
|
-
it {
|
|
403
|
+
it { is_expected.to_not be_valid }
|
|
406
404
|
end
|
|
407
405
|
end
|
|
408
406
|
end
|
|
@@ -420,9 +418,9 @@ describe Metasploit::Model::Search::Query do
|
|
|
420
418
|
'unknown_value'
|
|
421
419
|
end
|
|
422
420
|
|
|
423
|
-
it {
|
|
421
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operation::Base }
|
|
424
422
|
|
|
425
|
-
it {
|
|
423
|
+
it { is_expected.to be_invalid }
|
|
426
424
|
end
|
|
427
425
|
end
|
|
428
426
|
end
|
|
@@ -468,7 +466,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
468
466
|
end
|
|
469
467
|
|
|
470
468
|
it 'should have correct number of groups' do
|
|
471
|
-
operations_by_operator.length.
|
|
469
|
+
expect(operations_by_operator.length).to eq(@operators.length)
|
|
472
470
|
end
|
|
473
471
|
|
|
474
472
|
it 'should have correct value for each operator' do
|
|
@@ -489,7 +487,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
489
487
|
query
|
|
490
488
|
end
|
|
491
489
|
|
|
492
|
-
it {
|
|
490
|
+
it { is_expected.to be_valid }
|
|
493
491
|
end
|
|
494
492
|
end
|
|
495
493
|
|
|
@@ -503,7 +501,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
503
501
|
query
|
|
504
502
|
end
|
|
505
503
|
|
|
506
|
-
it {
|
|
504
|
+
it { is_expected.to_not be_valid }
|
|
507
505
|
end
|
|
508
506
|
end
|
|
509
507
|
end
|
|
@@ -542,7 +540,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
542
540
|
|
|
543
541
|
context 'with String' do
|
|
544
542
|
it 'should find operator' do
|
|
545
|
-
parse_operator.
|
|
543
|
+
expect(parse_operator).to eq(@operator)
|
|
546
544
|
end
|
|
547
545
|
end
|
|
548
546
|
|
|
@@ -552,7 +550,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
552
550
|
end
|
|
553
551
|
|
|
554
552
|
it 'should find operator' do
|
|
555
|
-
parse_operator.
|
|
553
|
+
expect(parse_operator).to eq(@operator)
|
|
556
554
|
end
|
|
557
555
|
end
|
|
558
556
|
end
|
|
@@ -562,7 +560,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
562
560
|
'unknown_operator'
|
|
563
561
|
end
|
|
564
562
|
|
|
565
|
-
it {
|
|
563
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operator::Null }
|
|
566
564
|
end
|
|
567
565
|
end
|
|
568
566
|
|
|
@@ -599,7 +597,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
599
597
|
tree
|
|
600
598
|
end
|
|
601
599
|
|
|
602
|
-
it {
|
|
600
|
+
it { is_expected.to be_a Metasploit::Model::Search::Group::Intersection }
|
|
603
601
|
|
|
604
602
|
context 'children' do
|
|
605
603
|
subject(:children) do
|
|
@@ -608,17 +606,17 @@ describe Metasploit::Model::Search::Query do
|
|
|
608
606
|
|
|
609
607
|
it 'should be an Array<Metasploit::Model::Search::Group::Union>' do
|
|
610
608
|
children.each do |child|
|
|
611
|
-
child.
|
|
609
|
+
expect(child).to be_a Metasploit::Model::Search::Group::Union
|
|
612
610
|
end
|
|
613
611
|
end
|
|
614
612
|
|
|
615
613
|
it 'should have same operator for each child of a union' do
|
|
616
614
|
children.each do |child|
|
|
617
|
-
operator_set = child.children.inject(Set.new) { |
|
|
618
|
-
|
|
615
|
+
operator_set = child.children.inject(Set.new) { |block_operator_set, operation|
|
|
616
|
+
block_operator_set.add operation.operator
|
|
619
617
|
}
|
|
620
618
|
|
|
621
|
-
operator_set.length.
|
|
619
|
+
expect(operator_set.length).to eq(1)
|
|
622
620
|
end
|
|
623
621
|
end
|
|
624
622
|
|
|
@@ -635,7 +633,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
635
633
|
|
|
636
634
|
it 'should be Array<Metasploit::Model::Search::Operation::Base>' do
|
|
637
635
|
grandchildren.each do |grandchild|
|
|
638
|
-
grandchild.
|
|
636
|
+
expect(grandchild).to be_a Metasploit::Model::Search::Operation::Base
|
|
639
637
|
end
|
|
640
638
|
end
|
|
641
639
|
end
|
|
@@ -701,15 +699,15 @@ describe Metasploit::Model::Search::Query do
|
|
|
701
699
|
end
|
|
702
700
|
|
|
703
701
|
it 'should return a new query' do
|
|
704
|
-
without_operator.
|
|
702
|
+
expect(without_operator).not_to be query
|
|
705
703
|
end
|
|
706
704
|
|
|
707
705
|
it 'should not have operations on the removed operator' do
|
|
708
|
-
without_operator.operations_by_operator[filtered_operator].
|
|
706
|
+
expect(without_operator.operations_by_operator[filtered_operator]).to be_blank
|
|
709
707
|
end
|
|
710
708
|
|
|
711
709
|
it 'should have same #klass as this query' do
|
|
712
|
-
without_operator.klass.
|
|
710
|
+
expect(without_operator.klass).to eq(query.klass)
|
|
713
711
|
end
|
|
714
712
|
|
|
715
713
|
context 'with no other operators' do
|
|
@@ -719,11 +717,11 @@ describe Metasploit::Model::Search::Query do
|
|
|
719
717
|
]
|
|
720
718
|
end
|
|
721
719
|
|
|
722
|
-
it {
|
|
720
|
+
it { is_expected.to_not be_valid }
|
|
723
721
|
end
|
|
724
722
|
|
|
725
723
|
context 'with other operators' do
|
|
726
|
-
it {
|
|
724
|
+
it { is_expected.to be_valid }
|
|
727
725
|
end
|
|
728
726
|
end
|
|
729
727
|
|
|
@@ -735,7 +733,7 @@ describe Metasploit::Model::Search::Query do
|
|
|
735
733
|
end
|
|
736
734
|
|
|
737
735
|
it 'should return this query' do
|
|
738
|
-
without_operator.
|
|
736
|
+
expect(without_operator).to be query
|
|
739
737
|
end
|
|
740
738
|
end
|
|
741
739
|
end
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
describe Metasploit::Model::Visitation::Visitor do
|
|
1
|
+
RSpec.describe Metasploit::Model::Visitation::Visitor, type: :model do
|
|
4
2
|
context 'validations' do
|
|
5
|
-
it {
|
|
6
|
-
it {
|
|
7
|
-
it {
|
|
3
|
+
it { is_expected.to validate_presence_of :block }
|
|
4
|
+
it { is_expected.to validate_presence_of :module_name }
|
|
5
|
+
it { is_expected.to validate_presence_of :parent }
|
|
8
6
|
end
|
|
9
7
|
|
|
10
8
|
context '#initialize' do
|
|
@@ -31,15 +29,15 @@ describe Metasploit::Model::Visitation::Visitor do
|
|
|
31
29
|
end
|
|
32
30
|
|
|
33
31
|
it 'should set #block from &block' do
|
|
34
|
-
instance.block.
|
|
32
|
+
expect(instance.block).to eq(block)
|
|
35
33
|
end
|
|
36
34
|
|
|
37
35
|
it 'should set #module_name from :module_name' do
|
|
38
|
-
instance.module_name.
|
|
36
|
+
expect(instance.module_name).to eq(module_name)
|
|
39
37
|
end
|
|
40
38
|
|
|
41
39
|
it 'should set #parent from :parent' do
|
|
42
|
-
instance.parent.
|
|
40
|
+
expect(instance.parent).to eq(parent)
|
|
43
41
|
end
|
|
44
42
|
end
|
|
45
43
|
end
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
describe IpFormatValidator do
|
|
1
|
+
RSpec.describe IpFormatValidator do
|
|
4
2
|
subject(:ip_format_validator) do
|
|
5
3
|
described_class.new(
|
|
6
4
|
:attributes => attributes
|
|
@@ -55,7 +53,7 @@ describe IpFormatValidator do
|
|
|
55
53
|
it 'should not record any errors' do
|
|
56
54
|
validate_each
|
|
57
55
|
|
|
58
|
-
record.errors.
|
|
56
|
+
expect(record.errors).to be_empty
|
|
59
57
|
end
|
|
60
58
|
end
|
|
61
59
|
|
|
@@ -67,7 +65,7 @@ describe IpFormatValidator do
|
|
|
67
65
|
it 'should not record any errors' do
|
|
68
66
|
validate_each
|
|
69
67
|
|
|
70
|
-
record.errors.
|
|
68
|
+
expect(record.errors).to be_empty
|
|
71
69
|
end
|
|
72
70
|
end
|
|
73
71
|
|
|
@@ -79,7 +77,7 @@ describe IpFormatValidator do
|
|
|
79
77
|
it 'should record error' do
|
|
80
78
|
validate_each
|
|
81
79
|
|
|
82
|
-
record.errors[attribute].
|
|
80
|
+
expect(record.errors[attribute]).to include("#{error} and not an IPv4 address range in CIDR or netmask notation")
|
|
83
81
|
end
|
|
84
82
|
end
|
|
85
83
|
|
|
@@ -91,7 +89,7 @@ describe IpFormatValidator do
|
|
|
91
89
|
it 'should record error' do
|
|
92
90
|
validate_each
|
|
93
91
|
|
|
94
|
-
record.errors[attribute].
|
|
92
|
+
expect(record.errors[attribute]).to include("#{error} and not an IPv6 address range in CIDR or netmask notation")
|
|
95
93
|
end
|
|
96
94
|
end
|
|
97
95
|
|
|
@@ -103,7 +101,7 @@ describe IpFormatValidator do
|
|
|
103
101
|
it 'should record error' do
|
|
104
102
|
validate_each
|
|
105
103
|
|
|
106
|
-
record.errors[attribute].
|
|
104
|
+
expect(record.errors[attribute]).to include(error)
|
|
107
105
|
end
|
|
108
106
|
end
|
|
109
107
|
|
|
@@ -117,7 +115,7 @@ describe IpFormatValidator do
|
|
|
117
115
|
it 'should record error on attribute' do
|
|
118
116
|
validate_each
|
|
119
117
|
|
|
120
|
-
record.errors[attribute].
|
|
118
|
+
expect(record.errors[attribute]).to include(error)
|
|
121
119
|
end
|
|
122
120
|
end
|
|
123
121
|
end
|