metasploit-model 0.30.0-java → 0.30.1-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -4
  3. data/Gemfile +1 -6
  4. data/lib/metasploit/model/version.rb +1 -1
  5. data/spec/app/models/metasploit/model/association/reflection_spec.rb +5 -7
  6. data/spec/app/models/metasploit/model/search/group/base_spec.rb +2 -4
  7. data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +2 -4
  8. data/spec/app/models/metasploit/model/search/group/union_spec.rb +2 -4
  9. data/spec/app/models/metasploit/model/search/operation/association_spec.rb +7 -9
  10. data/spec/app/models/metasploit/model/search/operation/base_spec.rb +5 -7
  11. data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +14 -11
  12. data/spec/app/models/metasploit/model/search/operation/date_spec.rb +6 -8
  13. data/spec/app/models/metasploit/model/search/operation/group/base_spec.rb +12 -14
  14. data/spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb +2 -4
  15. data/spec/app/models/metasploit/model/search/operation/group/union_spec.rb +2 -4
  16. data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +2 -4
  17. data/spec/app/models/metasploit/model/search/operation/null_spec.rb +4 -6
  18. data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +2 -4
  19. data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +2 -4
  20. data/spec/app/models/metasploit/model/search/operation/set_spec.rb +4 -6
  21. data/spec/app/models/metasploit/model/search/operation/string_spec.rb +2 -4
  22. data/spec/app/models/metasploit/model/search/operator/association_spec.rb +6 -8
  23. data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +12 -14
  24. data/spec/app/models/metasploit/model/search/operator/base_spec.rb +3 -5
  25. data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +13 -11
  26. data/spec/app/models/metasploit/model/search/operator/group/base_spec.rb +5 -7
  27. data/spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb +3 -5
  28. data/spec/app/models/metasploit/model/search/operator/group/union_spec.rb +3 -5
  29. data/spec/app/models/metasploit/model/search/operator/null_spec.rb +5 -7
  30. data/spec/app/models/metasploit/model/search/operator/single_spec.rb +26 -28
  31. data/spec/app/models/metasploit/model/search/query_spec.rb +48 -50
  32. data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +7 -9
  33. data/spec/app/validators/ip_format_validator_spec.rb +7 -9
  34. data/spec/app/validators/nil_validator_spec.rb +3 -5
  35. data/spec/app/validators/parameters_validator_spec.rb +29 -29
  36. data/spec/app/validators/password_is_strong_validator_spec.rb +17 -19
  37. data/spec/lib/metasploit/model/association/error_spec.rb +1 -3
  38. data/spec/lib/metasploit/model/association_spec.rb +8 -10
  39. data/spec/lib/metasploit/model/base_spec.rb +3 -5
  40. data/spec/lib/metasploit/model/engine_spec.rb +48 -11
  41. data/spec/lib/metasploit/model/file_spec.rb +3 -5
  42. data/spec/lib/metasploit/model/invalid_spec.rb +7 -9
  43. data/spec/lib/metasploit/model/login/status_spec.rb +1 -3
  44. data/spec/lib/metasploit/model/nilify_blanks_spec.rb +11 -13
  45. data/spec/lib/metasploit/model/realm/key_spec.rb +15 -17
  46. data/spec/lib/metasploit/model/search/association/tree_spec.rb +3 -5
  47. data/spec/lib/metasploit/model/search/association_spec.rb +2 -4
  48. data/spec/lib/metasploit/model/search/attribute_spec.rb +6 -8
  49. data/spec/lib/metasploit/model/search/operation/value/integer_spec.rb +1 -3
  50. data/spec/lib/metasploit/model/search/operation/value/string_spec.rb +1 -3
  51. data/spec/lib/metasploit/model/search/operation_spec.rb +11 -13
  52. data/spec/lib/metasploit/model/search/operator/help_spec.rb +1 -3
  53. data/spec/lib/metasploit/model/search/with_spec.rb +7 -9
  54. data/spec/lib/metasploit/model/search_spec.rb +11 -13
  55. data/spec/lib/metasploit/model/spec/error_spec.rb +2 -4
  56. data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +5 -7
  57. data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +4 -6
  58. data/spec/lib/metasploit/model/spec_spec.rb +9 -7
  59. data/spec/lib/metasploit/model/translation_spec.rb +10 -12
  60. data/spec/lib/metasploit/model/version_spec.rb +3 -5
  61. data/spec/lib/metasploit/model/visitation/visit_spec.rb +28 -26
  62. data/spec/matchers/validate_nilness_of_spec.rb +0 -2
  63. data/spec/spec_helper.rb +69 -7
  64. data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +1 -1
  65. data/spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb +8 -8
  66. data/spec/support/shared/examples/metasploit/model/search/operation/value/string.rb +5 -5
  67. data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +18 -16
  68. data/spec/support/shared/examples/metasploit/model/translation.rb +4 -4
  69. data/spec/support/shared/examples/search/query.rb +3 -3
  70. data/spec/support/shared/examples/search_association.rb +2 -2
  71. data/spec/support/shared/examples/search_attribute.rb +3 -3
  72. data/spec/support/shared/examples/search_with.rb +3 -3
  73. metadata +2 -2
@@ -1,8 +1,6 @@
1
- require 'spec_helper'
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 { should validate_presence_of :klass }
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.should == 0
46
+ expect(query.operations.length).to eq(0)
49
47
  end
50
48
 
51
49
  it 'should record error on operations' do
52
- errors.should include(error)
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.should_not include(error)
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.stub(:operations).and_return([operation])
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.should_not include(error)
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.should_not include(error)
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.should include('formatted_operator1:formatted value:1')
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.should include('formatted_operator2:formatted_value2')
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.should == expected_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.should_receive(:formatted_operations).with(formatted).and_return([])
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.should == expected_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.should_receive(:formatted_operations).and_return([])
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 { should be_a Metasploit::Model::Search::Operation::Boolean }
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 { should be_valid }
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 { should be_valid }
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 { should_not be_valid }
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 { should be_a Metasploit::Model::Search::Operation::Date }
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 { should be_valid }
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 { should_not be_valid }
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 { should be_a Metasploit::Model::Search::Operation::Integer }
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 { should be_valid }
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 { should be_invalid }
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 { should be_invalid }
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 { should be_a Metasploit::Model::Search::Operation::String }
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 { should be_valid }
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 { should_not be_valid }
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 { should be_a Metasploit::Model::Search::Operation::Base }
421
+ it { is_expected.to be_a Metasploit::Model::Search::Operation::Base }
424
422
 
425
- it { should be_invalid }
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.should == @operators.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 { should be_valid }
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 { should_not be_valid }
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.should == @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.should == @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 { should be_a Metasploit::Model::Search::Operator::Null }
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 { should be_a Metasploit::Model::Search::Group::Intersection }
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.should be_a Metasploit::Model::Search::Group::Union
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) { |operator_set, operation|
618
- operator_set.add operation.operator
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.should == 1
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.should be_a Metasploit::Model::Search::Operation::Base
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.should_not be query
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].should be_blank
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.should == query.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 { should_not be_valid }
720
+ it { is_expected.to_not be_valid }
723
721
  end
724
722
 
725
723
  context 'with other operators' do
726
- it { should be_valid }
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.should be query
736
+ expect(without_operator).to be query
739
737
  end
740
738
  end
741
739
  end
@@ -1,10 +1,8 @@
1
- require 'spec_helper'
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 { should validate_presence_of :block }
6
- it { should validate_presence_of :module_name }
7
- it { should validate_presence_of :parent }
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.should == 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.should == 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.should == parent
40
+ expect(instance.parent).to eq(parent)
43
41
  end
44
42
  end
45
43
  end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
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.should be_empty
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.should be_empty
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].should include("#{error} and not an IPv4 address range in CIDR or netmask notation")
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].should include("#{error} and not an IPv6 address range in CIDR or netmask notation")
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].should include(error)
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].should include(error)
118
+ expect(record.errors[attribute]).to include(error)
121
119
  end
122
120
  end
123
121
  end