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,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe NilValidator do
1
+ RSpec.describe NilValidator do
4
2
  subject(:nil_validator) do
5
3
  described_class.new(
6
4
  :attributes => attributes
@@ -50,7 +48,7 @@ describe NilValidator do
50
48
  it 'should record error on attribute' do
51
49
  validate_each
52
50
 
53
- record.errors[attribute].should include('must be nil')
51
+ expect(record.errors[attribute]).to include('must be nil')
54
52
  end
55
53
  end
56
54
 
@@ -62,7 +60,7 @@ describe NilValidator do
62
60
  it 'should not record any error' do
63
61
  validate_each
64
62
 
65
- record.errors.should be_empty
63
+ expect(record.errors).to be_empty
66
64
  end
67
65
  end
68
66
  end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe ParametersValidator do
1
+ RSpec.describe ParametersValidator do
4
2
  subject(:parameters_validator) do
5
3
  described_class.new(
6
4
  :attributes => attributes
@@ -29,7 +27,7 @@ describe ParametersValidator do
29
27
 
30
28
  context 'CONSTANTS' do
31
29
  it 'should define TYPE_SIGNATURE_SENTENCE' do
32
- described_class::TYPE_SIGNATURE_SENTENCE.should == type_signature_sentence
30
+ expect(described_class::TYPE_SIGNATURE_SENTENCE).to eq(type_signature_sentence)
33
31
  end
34
32
  end
35
33
 
@@ -48,7 +46,7 @@ describe ParametersValidator do
48
46
  end
49
47
 
50
48
  it 'should include prefix' do
51
- error_at.should include(prefix)
49
+ expect(error_at).to include(prefix)
52
50
  end
53
51
 
54
52
  it 'should include location_clause in same sentence as prefix' do
@@ -58,11 +56,11 @@ describe ParametersValidator do
58
56
  :index => index
59
57
  )
60
58
 
61
- error_at.should include("#{prefix} #{location_clause}.")
59
+ expect(error_at).to include("#{prefix} #{location_clause}.")
62
60
  end
63
61
 
64
62
  it 'should include TYPE_SIGNATURE_SENTENCE' do
65
- error_at.should include(type_signature_sentence)
63
+ expect(error_at).to include(type_signature_sentence)
66
64
  end
67
65
  end
68
66
 
@@ -81,9 +79,9 @@ describe ParametersValidator do
81
79
  end
82
80
 
83
81
  it 'should include extreme in prefix' do
84
- parameters_validator.should_receive(:error_at) do |*args|
82
+ expect(parameters_validator).to receive(:error_at) do |*args|
85
83
  options = args.first
86
- options[:prefix].should include(extreme.to_s)
84
+ expect(options[:prefix]).to include(extreme.to_s)
87
85
  end
88
86
 
89
87
  length_error_at
@@ -100,11 +98,11 @@ describe ParametersValidator do
100
98
  end
101
99
 
102
100
  it 'should include numerical index' do
103
- location_clause.should include("at index #{index}")
101
+ expect(location_clause).to include("at index #{index}")
104
102
  end
105
103
 
106
104
  it 'should include inspect of element' do
107
- location_clause.should include(element.inspect)
105
+ expect(location_clause).to include(element.inspect)
108
106
  end
109
107
  end
110
108
 
@@ -144,7 +142,7 @@ describe ParametersValidator do
144
142
  end
145
143
 
146
144
  it 'should call #length_error_at with :extreme => :few' do
147
- parameters_validator.should_receive(:length_error_at).with(
145
+ expect(parameters_validator).to receive(:length_error_at).with(
148
146
  hash_including(
149
147
  :extreme => :few
150
148
  )
@@ -156,7 +154,7 @@ describe ParametersValidator do
156
154
  it 'should record error' do
157
155
  validate_each
158
156
 
159
- errors.should_not be_empty
157
+ expect(errors).not_to be_empty
160
158
  end
161
159
  end
162
160
 
@@ -166,7 +164,7 @@ describe ParametersValidator do
166
164
  end
167
165
 
168
166
  it 'should call #length_error_at with :extreme => :many' do
169
- parameters_validator.should_receive(:length_error_at).with(
167
+ expect(parameters_validator).to receive(:length_error_at).with(
170
168
  hash_including(
171
169
  :extreme => :many
172
170
  )
@@ -178,7 +176,7 @@ describe ParametersValidator do
178
176
  it 'should record error' do
179
177
  validate_each
180
178
 
181
- errors.should_not be_empty
179
+ expect(errors).not_to be_empty
182
180
  end
183
181
  end
184
182
 
@@ -203,7 +201,7 @@ describe ParametersValidator do
203
201
  end
204
202
 
205
203
  it 'should call error_at with blank parameter name prefix' do
206
- parameters_validator.should_receive(:error_at).with(
204
+ expect(parameters_validator).to receive(:error_at).with(
207
205
  hash_including(
208
206
  :prefix => 'has blank parameter name'
209
207
  )
@@ -215,7 +213,7 @@ describe ParametersValidator do
215
213
  it 'should record error' do
216
214
  validate_each
217
215
 
218
- errors.should_not be_empty
216
+ expect(errors).not_to be_empty
219
217
  end
220
218
  end
221
219
 
@@ -227,7 +225,7 @@ describe ParametersValidator do
227
225
  it 'should not record error' do
228
226
  validate_each
229
227
 
230
- errors.should be_blank
228
+ expect(errors).to be_blank
231
229
  end
232
230
  end
233
231
  end
@@ -238,7 +236,7 @@ describe ParametersValidator do
238
236
  end
239
237
 
240
238
  it 'should call error_at with non-String prefix' do
241
- parameters_validator.should_receive(:error_at).with(
239
+ expect(parameters_validator).to receive(:error_at).with(
242
240
  hash_including(
243
241
  :prefix => "has non-String parameter name (#{parameter_name.inspect})"
244
242
  )
@@ -250,7 +248,7 @@ describe ParametersValidator do
250
248
  it 'should record error' do
251
249
  validate_each
252
250
 
253
- errors.should_not be_empty
251
+ expect(errors).not_to be_empty
254
252
  end
255
253
  end
256
254
  end
@@ -264,7 +262,7 @@ describe ParametersValidator do
264
262
  it 'should not record error' do
265
263
  validate_each
266
264
 
267
- errors.should be_blank
265
+ expect(errors).to be_blank
268
266
  end
269
267
  end
270
268
 
@@ -274,7 +272,7 @@ describe ParametersValidator do
274
272
  end
275
273
 
276
274
  it 'should call error_at with non-String prefix' do
277
- parameters_validator.should_receive(:error_at).with(
275
+ expect(parameters_validator).to receive(:error_at).with(
278
276
  hash_including(
279
277
  :prefix => "has non-String parameter value (#{parameter_value.inspect})"
280
278
  )
@@ -286,7 +284,7 @@ describe ParametersValidator do
286
284
  it 'should record error' do
287
285
  validate_each
288
286
 
289
- errors.should_not be_empty
287
+ expect(errors).not_to be_empty
290
288
  end
291
289
  end
292
290
  end
@@ -299,7 +297,7 @@ describe ParametersValidator do
299
297
  end
300
298
 
301
299
  it 'should use #error_at with has non-Array for prefix' do
302
- parameters_validator.should_receive(:error_at).with(
300
+ expect(parameters_validator).to receive(:error_at).with(
303
301
  hash_including(
304
302
  :prefix => 'has non-Array'
305
303
  )
@@ -311,7 +309,7 @@ describe ParametersValidator do
311
309
  it 'should record error' do
312
310
  validate_each
313
311
 
314
- errors.should_not be_empty
312
+ expect(errors).not_to be_empty
315
313
  end
316
314
  end
317
315
  end
@@ -327,14 +325,16 @@ describe ParametersValidator do
327
325
  end
328
326
 
329
327
  it 'should error that attribute is not an array' do
330
- errors.any? { |error|
331
- error.include? 'is not an Array.'
332
- }.should be_true
328
+ expect(
329
+ errors.any? { |error|
330
+ error.include? 'is not an Array.'
331
+ }
332
+ ).to eq(true)
333
333
  end
334
334
 
335
335
  it 'should include TYPE_SIGNATURE_SENTENCE' do
336
336
  errors.each do |error|
337
- error.should include(type_signature_sentence)
337
+ expect(error).to include(type_signature_sentence)
338
338
  end
339
339
  end
340
340
  end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe PasswordIsStrongValidator do
1
+ RSpec.describe PasswordIsStrongValidator do
4
2
  subject(:password_is_strong_validator) do
5
3
  described_class.new(
6
4
  :attributes => attributes
@@ -27,7 +25,7 @@ describe PasswordIsStrongValidator do
27
25
  'aaaaa'
28
26
  end
29
27
 
30
- it { should be_true }
28
+ it { is_expected.to eq(true) }
31
29
  end
32
30
 
33
31
  context 'with repeats of 2 characters' do
@@ -35,7 +33,7 @@ describe PasswordIsStrongValidator do
35
33
  'abab'
36
34
  end
37
35
 
38
- it { should be_true }
36
+ it { is_expected.to eq(true) }
39
37
  end
40
38
 
41
39
  context 'with repeats of 3 characters' do
@@ -43,7 +41,7 @@ describe PasswordIsStrongValidator do
43
41
  'abcabc'
44
42
  end
45
43
 
46
- it { should be_true }
44
+ it { is_expected.to eq(true) }
47
45
  end
48
46
 
49
47
  context 'with repeats of 4 characters' do
@@ -51,7 +49,7 @@ describe PasswordIsStrongValidator do
51
49
  'abcdabcd'
52
50
  end
53
51
 
54
- it { should be_true }
52
+ it { is_expected.to eq(true) }
55
53
  end
56
54
 
57
55
  context 'without any repeats' do
@@ -59,7 +57,7 @@ describe PasswordIsStrongValidator do
59
57
  'abcdefgh'
60
58
  end
61
59
 
62
- it { should be_false }
60
+ it { is_expected.to eq(false) }
63
61
  end
64
62
  end
65
63
 
@@ -77,7 +75,7 @@ describe PasswordIsStrongValidator do
77
75
  ''
78
76
  end
79
77
 
80
- it { should be_false }
78
+ it { is_expected.to eq(false) }
81
79
  end
82
80
 
83
81
  context 'without blank password' do
@@ -90,7 +88,7 @@ describe PasswordIsStrongValidator do
90
88
  ''
91
89
  end
92
90
 
93
- it { should be_false }
91
+ it { is_expected.to eq(false) }
94
92
  end
95
93
 
96
94
  context 'without blank username' do
@@ -99,7 +97,7 @@ describe PasswordIsStrongValidator do
99
97
  end
100
98
 
101
99
  it 'should escape username' do
102
- Regexp.should_receive(:escape).with(username).and_call_original
100
+ expect(Regexp).to receive(:escape).with(username).and_call_original
103
101
 
104
102
  contains_username?
105
103
  end
@@ -110,7 +108,7 @@ describe PasswordIsStrongValidator do
110
108
  username.titleize
111
109
  end
112
110
 
113
- it { should be_true }
111
+ it { is_expected.to eq(true) }
114
112
  end
115
113
 
116
114
  context 'of same case' do
@@ -118,7 +116,7 @@ describe PasswordIsStrongValidator do
118
116
  username
119
117
  end
120
118
 
121
- it { should be_true }
119
+ it { is_expected.to eq(true) }
122
120
  end
123
121
  end
124
122
  end
@@ -167,7 +165,7 @@ describe PasswordIsStrongValidator do
167
165
  it 'should not record any error' do
168
166
  validate_each
169
167
 
170
- record.errors.should be_empty
168
+ expect(record.errors).to be_empty
171
169
  end
172
170
  end
173
171
 
@@ -180,7 +178,7 @@ describe PasswordIsStrongValidator do
180
178
  it 'should record error on attributes' do
181
179
  validate_each
182
180
 
183
- record.errors[attribute].should include('must contain letters, numbers, and at least one special character')
181
+ expect(record.errors[attribute]).to include('must contain letters, numbers, and at least one special character')
184
182
  end
185
183
  end
186
184
 
@@ -201,7 +199,7 @@ describe PasswordIsStrongValidator do
201
199
  it 'should record error on attribute' do
202
200
  validate_each
203
201
 
204
- record.errors[attribute].should include('must not contain the username')
202
+ expect(record.errors[attribute]).to include('must not contain the username')
205
203
  end
206
204
  end
207
205
 
@@ -214,7 +212,7 @@ describe PasswordIsStrongValidator do
214
212
  it 'should record error on attribute' do
215
213
  validate_each
216
214
 
217
- record.errors[attribute].should include('must not be a common password')
215
+ expect(record.errors[attribute]).to include('must not be a common password')
218
216
  end
219
217
  end
220
218
 
@@ -227,7 +225,7 @@ describe PasswordIsStrongValidator do
227
225
  it 'should record error on attribute' do
228
226
  validate_each
229
227
 
230
- record.errors[attribute].should include('must not be a predictable sequence of characters')
228
+ expect(record.errors[attribute]).to include('must not be a predictable sequence of characters')
231
229
  end
232
230
  end
233
231
 
@@ -239,7 +237,7 @@ describe PasswordIsStrongValidator do
239
237
  it 'should not record any errors' do
240
238
  validate_each
241
239
 
242
- record.errors.should be_empty
240
+ expect(record.errors).to be_empty
243
241
  end
244
242
  end
245
243
  end
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Association::Error do
1
+ RSpec.describe Metasploit::Model::Association::Error do
4
2
  context '#initialize' do
5
3
  let(:attributes) do
6
4
  {
@@ -1,6 +1,4 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Association do
1
+ RSpec.describe Metasploit::Model::Association do
4
2
  subject(:base_class) do
5
3
  described_class = self.described_class
6
4
 
@@ -54,7 +52,7 @@ describe Metasploit::Model::Association do
54
52
  end
55
53
 
56
54
  it 'should be class on which association was called' do
57
- model.should == base_class
55
+ expect(model).to eq(base_class)
58
56
  end
59
57
  end
60
58
 
@@ -64,7 +62,7 @@ describe Metasploit::Model::Association do
64
62
  end
65
63
 
66
64
  it 'should be name passed to association as a Symbol' do
67
- reflection_name.should == name.to_sym
65
+ expect(reflection_name).to eq(name.to_sym)
68
66
  end
69
67
  end
70
68
 
@@ -74,7 +72,7 @@ describe Metasploit::Model::Association do
74
72
  end
75
73
 
76
74
  it 'should be :class_name passed to association' do
77
- reflection_class_name.should == class_name
75
+ expect(reflection_class_name).to eq(class_name)
78
76
  end
79
77
  end
80
78
  end
@@ -87,7 +85,7 @@ describe Metasploit::Model::Association do
87
85
  end
88
86
 
89
87
  it 'should default to empty Hash' do
90
- association_by_name.should == {}
88
+ expect(association_by_name).to eq({})
91
89
  end
92
90
  end
93
91
 
@@ -119,7 +117,7 @@ describe Metasploit::Model::Association do
119
117
  end
120
118
 
121
119
  it 'should be class_name passed to association' do
122
- reflection_class_name.should == class_name
120
+ expect(reflection_class_name).to eq(class_name)
123
121
  end
124
122
  end
125
123
 
@@ -129,7 +127,7 @@ describe Metasploit::Model::Association do
129
127
  end
130
128
 
131
129
  it 'should have the reflected name' do
132
- reflection.name.should == reflected_name
130
+ expect(reflection.name).to eq(reflected_name)
133
131
  end
134
132
  end
135
133
  end
@@ -139,7 +137,7 @@ describe Metasploit::Model::Association do
139
137
  :unassociated_things
140
138
  end
141
139
 
142
- it { should be_nil }
140
+ it { is_expected.to be_nil }
143
141
  end
144
142
  end
145
143
  end