metasploit-model 0.30.2 → 1.0.0.pre.rails.pre.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +4 -2
  3. data/CONTRIBUTING.md +49 -9
  4. data/Gemfile +8 -3
  5. data/lib/metasploit/model.rb +5 -0
  6. data/lib/metasploit/model/engine.rb +1 -1
  7. data/lib/metasploit/model/version.rb +14 -26
  8. data/metasploit-model.gemspec +5 -3
  9. data/spec/app/models/metasploit/model/association/reflection_spec.rb +7 -5
  10. data/spec/app/models/metasploit/model/search/group/base_spec.rb +4 -2
  11. data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +4 -2
  12. data/spec/app/models/metasploit/model/search/group/union_spec.rb +4 -2
  13. data/spec/app/models/metasploit/model/search/operation/association_spec.rb +9 -7
  14. data/spec/app/models/metasploit/model/search/operation/base_spec.rb +7 -5
  15. data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +11 -14
  16. data/spec/app/models/metasploit/model/search/operation/date_spec.rb +8 -6
  17. data/spec/app/models/metasploit/model/search/operation/group/base_spec.rb +14 -12
  18. data/spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb +4 -2
  19. data/spec/app/models/metasploit/model/search/operation/group/union_spec.rb +4 -2
  20. data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +4 -2
  21. data/spec/app/models/metasploit/model/search/operation/null_spec.rb +6 -4
  22. data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +4 -2
  23. data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +4 -2
  24. data/spec/app/models/metasploit/model/search/operation/set_spec.rb +6 -4
  25. data/spec/app/models/metasploit/model/search/operation/string_spec.rb +4 -2
  26. data/spec/app/models/metasploit/model/search/operator/association_spec.rb +8 -6
  27. data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +14 -12
  28. data/spec/app/models/metasploit/model/search/operator/base_spec.rb +5 -3
  29. data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +11 -13
  30. data/spec/app/models/metasploit/model/search/operator/group/base_spec.rb +7 -5
  31. data/spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb +5 -3
  32. data/spec/app/models/metasploit/model/search/operator/group/union_spec.rb +5 -3
  33. data/spec/app/models/metasploit/model/search/operator/null_spec.rb +7 -5
  34. data/spec/app/models/metasploit/model/search/operator/single_spec.rb +28 -26
  35. data/spec/app/models/metasploit/model/search/query_spec.rb +50 -48
  36. data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +9 -7
  37. data/spec/app/validators/ip_format_validator_spec.rb +9 -7
  38. data/spec/app/validators/nil_validator_spec.rb +5 -3
  39. data/spec/app/validators/parameters_validator_spec.rb +29 -29
  40. data/spec/app/validators/password_is_strong_validator_spec.rb +19 -17
  41. data/spec/dummy/config/application.rb +3 -1
  42. data/spec/dummy/config/environments/development.rb +0 -3
  43. data/spec/lib/metasploit/model/association/error_spec.rb +3 -1
  44. data/spec/lib/metasploit/model/association_spec.rb +10 -8
  45. data/spec/lib/metasploit/model/base_spec.rb +5 -3
  46. data/spec/lib/metasploit/model/engine_spec.rb +11 -48
  47. data/spec/lib/metasploit/model/file_spec.rb +5 -3
  48. data/spec/lib/metasploit/model/invalid_spec.rb +9 -7
  49. data/spec/lib/metasploit/model/login/status_spec.rb +3 -1
  50. data/spec/lib/metasploit/model/nilify_blanks_spec.rb +13 -11
  51. data/spec/lib/metasploit/model/realm/key_spec.rb +17 -15
  52. data/spec/lib/metasploit/model/search/association/tree_spec.rb +5 -3
  53. data/spec/lib/metasploit/model/search/association_spec.rb +4 -2
  54. data/spec/lib/metasploit/model/search/attribute_spec.rb +8 -6
  55. data/spec/lib/metasploit/model/search/operation/value/integer_spec.rb +3 -1
  56. data/spec/lib/metasploit/model/search/operation/value/string_spec.rb +3 -1
  57. data/spec/lib/metasploit/model/search/operation_spec.rb +13 -11
  58. data/spec/lib/metasploit/model/search/operator/help_spec.rb +3 -1
  59. data/spec/lib/metasploit/model/search/with_spec.rb +9 -7
  60. data/spec/lib/metasploit/model/search_spec.rb +13 -11
  61. data/spec/lib/metasploit/model/spec/error_spec.rb +4 -2
  62. data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +7 -5
  63. data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +6 -4
  64. data/spec/lib/metasploit/model/spec_spec.rb +7 -9
  65. data/spec/lib/metasploit/model/translation_spec.rb +12 -10
  66. data/spec/lib/metasploit/model/version_spec.rb +139 -3
  67. data/spec/lib/metasploit/model/visitation/visit_spec.rb +26 -28
  68. data/spec/matchers/validate_nilness_of_spec.rb +2 -0
  69. data/spec/spec_helper.rb +10 -80
  70. data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +1 -1
  71. data/spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb +8 -8
  72. data/spec/support/shared/examples/metasploit/model/search/operation/value/string.rb +5 -5
  73. data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +16 -18
  74. data/spec/support/shared/examples/metasploit/model/translation.rb +4 -4
  75. data/spec/support/shared/examples/search/query.rb +3 -3
  76. data/spec/support/shared/examples/search_association.rb +2 -2
  77. data/spec/support/shared/examples/search_attribute.rb +3 -3
  78. data/spec/support/shared/examples/search_with.rb +3 -3
  79. metadata +20 -27
  80. data/CHANGELOG.md +0 -6
  81. data/RELEASING.md +0 -86
  82. data/UPGRADING.md +0 -1
  83. data/spec/lib/metasploit/model_spec.rb +0 -4
@@ -1,8 +1,10 @@
1
- RSpec.describe Metasploit::Model::Visitation::Visitor, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Visitation::Visitor do
2
4
  context 'validations' do
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 }
5
+ it { should validate_presence_of :block }
6
+ it { should validate_presence_of :module_name }
7
+ it { should validate_presence_of :parent }
6
8
  end
7
9
 
8
10
  context '#initialize' do
@@ -29,15 +31,15 @@ RSpec.describe Metasploit::Model::Visitation::Visitor, type: :model do
29
31
  end
30
32
 
31
33
  it 'should set #block from &block' do
32
- expect(instance.block).to eq(block)
34
+ instance.block.should == block
33
35
  end
34
36
 
35
37
  it 'should set #module_name from :module_name' do
36
- expect(instance.module_name).to eq(module_name)
38
+ instance.module_name.should == module_name
37
39
  end
38
40
 
39
41
  it 'should set #parent from :parent' do
40
- expect(instance.parent).to eq(parent)
42
+ instance.parent.should == parent
41
43
  end
42
44
  end
43
45
  end
@@ -1,4 +1,6 @@
1
- RSpec.describe IpFormatValidator do
1
+ require 'spec_helper'
2
+
3
+ describe IpFormatValidator do
2
4
  subject(:ip_format_validator) do
3
5
  described_class.new(
4
6
  :attributes => attributes
@@ -53,7 +55,7 @@ RSpec.describe IpFormatValidator do
53
55
  it 'should not record any errors' do
54
56
  validate_each
55
57
 
56
- expect(record.errors).to be_empty
58
+ record.errors.should be_empty
57
59
  end
58
60
  end
59
61
 
@@ -65,7 +67,7 @@ RSpec.describe IpFormatValidator do
65
67
  it 'should not record any errors' do
66
68
  validate_each
67
69
 
68
- expect(record.errors).to be_empty
70
+ record.errors.should be_empty
69
71
  end
70
72
  end
71
73
 
@@ -77,7 +79,7 @@ RSpec.describe IpFormatValidator do
77
79
  it 'should record error' do
78
80
  validate_each
79
81
 
80
- expect(record.errors[attribute]).to include("#{error} and not an IPv4 address range in CIDR or netmask notation")
82
+ record.errors[attribute].should include("#{error} and not an IPv4 address range in CIDR or netmask notation")
81
83
  end
82
84
  end
83
85
 
@@ -89,7 +91,7 @@ RSpec.describe IpFormatValidator do
89
91
  it 'should record error' do
90
92
  validate_each
91
93
 
92
- expect(record.errors[attribute]).to include("#{error} and not an IPv6 address range in CIDR or netmask notation")
94
+ record.errors[attribute].should include("#{error} and not an IPv6 address range in CIDR or netmask notation")
93
95
  end
94
96
  end
95
97
 
@@ -101,7 +103,7 @@ RSpec.describe IpFormatValidator do
101
103
  it 'should record error' do
102
104
  validate_each
103
105
 
104
- expect(record.errors[attribute]).to include(error)
106
+ record.errors[attribute].should include(error)
105
107
  end
106
108
  end
107
109
 
@@ -115,7 +117,7 @@ RSpec.describe IpFormatValidator do
115
117
  it 'should record error on attribute' do
116
118
  validate_each
117
119
 
118
- expect(record.errors[attribute]).to include(error)
120
+ record.errors[attribute].should include(error)
119
121
  end
120
122
  end
121
123
  end
@@ -1,4 +1,6 @@
1
- RSpec.describe NilValidator do
1
+ require 'spec_helper'
2
+
3
+ describe NilValidator do
2
4
  subject(:nil_validator) do
3
5
  described_class.new(
4
6
  :attributes => attributes
@@ -48,7 +50,7 @@ RSpec.describe NilValidator do
48
50
  it 'should record error on attribute' do
49
51
  validate_each
50
52
 
51
- expect(record.errors[attribute]).to include('must be nil')
53
+ record.errors[attribute].should include('must be nil')
52
54
  end
53
55
  end
54
56
 
@@ -60,7 +62,7 @@ RSpec.describe NilValidator do
60
62
  it 'should not record any error' do
61
63
  validate_each
62
64
 
63
- expect(record.errors).to be_empty
65
+ record.errors.should be_empty
64
66
  end
65
67
  end
66
68
  end
@@ -1,4 +1,6 @@
1
- RSpec.describe ParametersValidator do
1
+ require 'spec_helper'
2
+
3
+ describe ParametersValidator do
2
4
  subject(:parameters_validator) do
3
5
  described_class.new(
4
6
  :attributes => attributes
@@ -27,7 +29,7 @@ RSpec.describe ParametersValidator do
27
29
 
28
30
  context 'CONSTANTS' do
29
31
  it 'should define TYPE_SIGNATURE_SENTENCE' do
30
- expect(described_class::TYPE_SIGNATURE_SENTENCE).to eq(type_signature_sentence)
32
+ described_class::TYPE_SIGNATURE_SENTENCE.should == type_signature_sentence
31
33
  end
32
34
  end
33
35
 
@@ -46,7 +48,7 @@ RSpec.describe ParametersValidator do
46
48
  end
47
49
 
48
50
  it 'should include prefix' do
49
- expect(error_at).to include(prefix)
51
+ error_at.should include(prefix)
50
52
  end
51
53
 
52
54
  it 'should include location_clause in same sentence as prefix' do
@@ -56,11 +58,11 @@ RSpec.describe ParametersValidator do
56
58
  :index => index
57
59
  )
58
60
 
59
- expect(error_at).to include("#{prefix} #{location_clause}.")
61
+ error_at.should include("#{prefix} #{location_clause}.")
60
62
  end
61
63
 
62
64
  it 'should include TYPE_SIGNATURE_SENTENCE' do
63
- expect(error_at).to include(type_signature_sentence)
65
+ error_at.should include(type_signature_sentence)
64
66
  end
65
67
  end
66
68
 
@@ -79,9 +81,9 @@ RSpec.describe ParametersValidator do
79
81
  end
80
82
 
81
83
  it 'should include extreme in prefix' do
82
- expect(parameters_validator).to receive(:error_at) do |*args|
84
+ parameters_validator.should_receive(:error_at) do |*args|
83
85
  options = args.first
84
- expect(options[:prefix]).to include(extreme.to_s)
86
+ options[:prefix].should include(extreme.to_s)
85
87
  end
86
88
 
87
89
  length_error_at
@@ -98,11 +100,11 @@ RSpec.describe ParametersValidator do
98
100
  end
99
101
 
100
102
  it 'should include numerical index' do
101
- expect(location_clause).to include("at index #{index}")
103
+ location_clause.should include("at index #{index}")
102
104
  end
103
105
 
104
106
  it 'should include inspect of element' do
105
- expect(location_clause).to include(element.inspect)
107
+ location_clause.should include(element.inspect)
106
108
  end
107
109
  end
108
110
 
@@ -142,7 +144,7 @@ RSpec.describe ParametersValidator do
142
144
  end
143
145
 
144
146
  it 'should call #length_error_at with :extreme => :few' do
145
- expect(parameters_validator).to receive(:length_error_at).with(
147
+ parameters_validator.should_receive(:length_error_at).with(
146
148
  hash_including(
147
149
  :extreme => :few
148
150
  )
@@ -154,7 +156,7 @@ RSpec.describe ParametersValidator do
154
156
  it 'should record error' do
155
157
  validate_each
156
158
 
157
- expect(errors).not_to be_empty
159
+ errors.should_not be_empty
158
160
  end
159
161
  end
160
162
 
@@ -164,7 +166,7 @@ RSpec.describe ParametersValidator do
164
166
  end
165
167
 
166
168
  it 'should call #length_error_at with :extreme => :many' do
167
- expect(parameters_validator).to receive(:length_error_at).with(
169
+ parameters_validator.should_receive(:length_error_at).with(
168
170
  hash_including(
169
171
  :extreme => :many
170
172
  )
@@ -176,7 +178,7 @@ RSpec.describe ParametersValidator do
176
178
  it 'should record error' do
177
179
  validate_each
178
180
 
179
- expect(errors).not_to be_empty
181
+ errors.should_not be_empty
180
182
  end
181
183
  end
182
184
 
@@ -201,7 +203,7 @@ RSpec.describe ParametersValidator do
201
203
  end
202
204
 
203
205
  it 'should call error_at with blank parameter name prefix' do
204
- expect(parameters_validator).to receive(:error_at).with(
206
+ parameters_validator.should_receive(:error_at).with(
205
207
  hash_including(
206
208
  :prefix => 'has blank parameter name'
207
209
  )
@@ -213,7 +215,7 @@ RSpec.describe ParametersValidator do
213
215
  it 'should record error' do
214
216
  validate_each
215
217
 
216
- expect(errors).not_to be_empty
218
+ errors.should_not be_empty
217
219
  end
218
220
  end
219
221
 
@@ -225,7 +227,7 @@ RSpec.describe ParametersValidator do
225
227
  it 'should not record error' do
226
228
  validate_each
227
229
 
228
- expect(errors).to be_blank
230
+ errors.should be_blank
229
231
  end
230
232
  end
231
233
  end
@@ -236,7 +238,7 @@ RSpec.describe ParametersValidator do
236
238
  end
237
239
 
238
240
  it 'should call error_at with non-String prefix' do
239
- expect(parameters_validator).to receive(:error_at).with(
241
+ parameters_validator.should_receive(:error_at).with(
240
242
  hash_including(
241
243
  :prefix => "has non-String parameter name (#{parameter_name.inspect})"
242
244
  )
@@ -248,7 +250,7 @@ RSpec.describe ParametersValidator do
248
250
  it 'should record error' do
249
251
  validate_each
250
252
 
251
- expect(errors).not_to be_empty
253
+ errors.should_not be_empty
252
254
  end
253
255
  end
254
256
  end
@@ -262,7 +264,7 @@ RSpec.describe ParametersValidator do
262
264
  it 'should not record error' do
263
265
  validate_each
264
266
 
265
- expect(errors).to be_blank
267
+ errors.should be_blank
266
268
  end
267
269
  end
268
270
 
@@ -272,7 +274,7 @@ RSpec.describe ParametersValidator do
272
274
  end
273
275
 
274
276
  it 'should call error_at with non-String prefix' do
275
- expect(parameters_validator).to receive(:error_at).with(
277
+ parameters_validator.should_receive(:error_at).with(
276
278
  hash_including(
277
279
  :prefix => "has non-String parameter value (#{parameter_value.inspect})"
278
280
  )
@@ -284,7 +286,7 @@ RSpec.describe ParametersValidator do
284
286
  it 'should record error' do
285
287
  validate_each
286
288
 
287
- expect(errors).not_to be_empty
289
+ errors.should_not be_empty
288
290
  end
289
291
  end
290
292
  end
@@ -297,7 +299,7 @@ RSpec.describe ParametersValidator do
297
299
  end
298
300
 
299
301
  it 'should use #error_at with has non-Array for prefix' do
300
- expect(parameters_validator).to receive(:error_at).with(
302
+ parameters_validator.should_receive(:error_at).with(
301
303
  hash_including(
302
304
  :prefix => 'has non-Array'
303
305
  )
@@ -309,7 +311,7 @@ RSpec.describe ParametersValidator do
309
311
  it 'should record error' do
310
312
  validate_each
311
313
 
312
- expect(errors).not_to be_empty
314
+ errors.should_not be_empty
313
315
  end
314
316
  end
315
317
  end
@@ -325,16 +327,14 @@ RSpec.describe ParametersValidator do
325
327
  end
326
328
 
327
329
  it 'should error that attribute is not an array' do
328
- expect(
329
- errors.any? { |error|
330
- error.include? 'is not an Array.'
331
- }
332
- ).to eq(true)
330
+ errors.any? { |error|
331
+ error.include? 'is not an Array.'
332
+ }.should be_true
333
333
  end
334
334
 
335
335
  it 'should include TYPE_SIGNATURE_SENTENCE' do
336
336
  errors.each do |error|
337
- expect(error).to include(type_signature_sentence)
337
+ error.should include(type_signature_sentence)
338
338
  end
339
339
  end
340
340
  end
@@ -1,4 +1,6 @@
1
- RSpec.describe PasswordIsStrongValidator do
1
+ require 'spec_helper'
2
+
3
+ describe PasswordIsStrongValidator do
2
4
  subject(:password_is_strong_validator) do
3
5
  described_class.new(
4
6
  :attributes => attributes
@@ -25,7 +27,7 @@ RSpec.describe PasswordIsStrongValidator do
25
27
  'aaaaa'
26
28
  end
27
29
 
28
- it { is_expected.to eq(true) }
30
+ it { should be_true }
29
31
  end
30
32
 
31
33
  context 'with repeats of 2 characters' do
@@ -33,7 +35,7 @@ RSpec.describe PasswordIsStrongValidator do
33
35
  'abab'
34
36
  end
35
37
 
36
- it { is_expected.to eq(true) }
38
+ it { should be_true }
37
39
  end
38
40
 
39
41
  context 'with repeats of 3 characters' do
@@ -41,7 +43,7 @@ RSpec.describe PasswordIsStrongValidator do
41
43
  'abcabc'
42
44
  end
43
45
 
44
- it { is_expected.to eq(true) }
46
+ it { should be_true }
45
47
  end
46
48
 
47
49
  context 'with repeats of 4 characters' do
@@ -49,7 +51,7 @@ RSpec.describe PasswordIsStrongValidator do
49
51
  'abcdabcd'
50
52
  end
51
53
 
52
- it { is_expected.to eq(true) }
54
+ it { should be_true }
53
55
  end
54
56
 
55
57
  context 'without any repeats' do
@@ -57,7 +59,7 @@ RSpec.describe PasswordIsStrongValidator do
57
59
  'abcdefgh'
58
60
  end
59
61
 
60
- it { is_expected.to eq(false) }
62
+ it { should be_false }
61
63
  end
62
64
  end
63
65
 
@@ -75,7 +77,7 @@ RSpec.describe PasswordIsStrongValidator do
75
77
  ''
76
78
  end
77
79
 
78
- it { is_expected.to eq(false) }
80
+ it { should be_false }
79
81
  end
80
82
 
81
83
  context 'without blank password' do
@@ -88,7 +90,7 @@ RSpec.describe PasswordIsStrongValidator do
88
90
  ''
89
91
  end
90
92
 
91
- it { is_expected.to eq(false) }
93
+ it { should be_false }
92
94
  end
93
95
 
94
96
  context 'without blank username' do
@@ -97,7 +99,7 @@ RSpec.describe PasswordIsStrongValidator do
97
99
  end
98
100
 
99
101
  it 'should escape username' do
100
- expect(Regexp).to receive(:escape).with(username).and_call_original
102
+ Regexp.should_receive(:escape).with(username).and_call_original
101
103
 
102
104
  contains_username?
103
105
  end
@@ -108,7 +110,7 @@ RSpec.describe PasswordIsStrongValidator do
108
110
  username.titleize
109
111
  end
110
112
 
111
- it { is_expected.to eq(true) }
113
+ it { should be_true }
112
114
  end
113
115
 
114
116
  context 'of same case' do
@@ -116,7 +118,7 @@ RSpec.describe PasswordIsStrongValidator do
116
118
  username
117
119
  end
118
120
 
119
- it { is_expected.to eq(true) }
121
+ it { should be_true }
120
122
  end
121
123
  end
122
124
  end
@@ -165,7 +167,7 @@ RSpec.describe PasswordIsStrongValidator do
165
167
  it 'should not record any error' do
166
168
  validate_each
167
169
 
168
- expect(record.errors).to be_empty
170
+ record.errors.should be_empty
169
171
  end
170
172
  end
171
173
 
@@ -178,7 +180,7 @@ RSpec.describe PasswordIsStrongValidator do
178
180
  it 'should record error on attributes' do
179
181
  validate_each
180
182
 
181
- expect(record.errors[attribute]).to include('must contain letters, numbers, and at least one special character')
183
+ record.errors[attribute].should include('must contain letters, numbers, and at least one special character')
182
184
  end
183
185
  end
184
186
 
@@ -199,7 +201,7 @@ RSpec.describe PasswordIsStrongValidator do
199
201
  it 'should record error on attribute' do
200
202
  validate_each
201
203
 
202
- expect(record.errors[attribute]).to include('must not contain the username')
204
+ record.errors[attribute].should include('must not contain the username')
203
205
  end
204
206
  end
205
207
 
@@ -212,7 +214,7 @@ RSpec.describe PasswordIsStrongValidator do
212
214
  it 'should record error on attribute' do
213
215
  validate_each
214
216
 
215
- expect(record.errors[attribute]).to include('must not be a common password')
217
+ record.errors[attribute].should include('must not be a common password')
216
218
  end
217
219
  end
218
220
 
@@ -225,7 +227,7 @@ RSpec.describe PasswordIsStrongValidator do
225
227
  it 'should record error on attribute' do
226
228
  validate_each
227
229
 
228
- expect(record.errors[attribute]).to include('must not be a predictable sequence of characters')
230
+ record.errors[attribute].should include('must not be a predictable sequence of characters')
229
231
  end
230
232
  end
231
233
 
@@ -237,7 +239,7 @@ RSpec.describe PasswordIsStrongValidator do
237
239
  it 'should not record any errors' do
238
240
  validate_each
239
241
 
240
- expect(record.errors).to be_empty
242
+ record.errors.should be_empty
241
243
  end
242
244
  end
243
245
  end