metasploit_data_models 0.24.1.pre.rspec.pre.3.pre.1 → 0.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -3
- data/Gemfile +3 -1
- data/app/models/metasploit_data_models/ip_address/v4/segmented.rb +1 -1
- data/app/models/metasploit_data_models/search/visitor/where.rb +1 -1
- data/app/validators/password_is_strong_validator.rb +1 -1
- data/lib/mdm/host/operating_system_normalization.rb +10 -0
- data/lib/metasploit_data_models/version.rb +1 -2
- data/metasploit_data_models.gemspec +1 -1
- data/spec/app/models/mdm/api_key_spec.rb +3 -1
- data/spec/app/models/mdm/client_spec.rb +11 -9
- data/spec/app/models/mdm/cred_spec.rb +54 -42
- data/spec/app/models/mdm/event_spec.rb +23 -21
- data/spec/app/models/mdm/exploit_attempt_spec.rb +21 -19
- data/spec/app/models/mdm/exploited_host_spec.rb +13 -11
- data/spec/app/models/mdm/host_detail_spec.rb +17 -15
- data/spec/app/models/mdm/host_spec.rb +260 -261
- data/spec/app/models/mdm/host_tag_spec.rb +8 -6
- data/spec/app/models/mdm/listener_spec.rb +32 -30
- data/spec/app/models/mdm/loot_spec.rb +23 -21
- data/spec/app/models/mdm/macro_spec.rb +3 -1
- data/spec/app/models/mdm/mod_ref_spec.rb +3 -1
- data/spec/app/models/mdm/module/action_spec.rb +12 -10
- data/spec/app/models/mdm/module/arch_spec.rb +12 -10
- data/spec/app/models/mdm/module/author_spec.rb +17 -22
- data/spec/app/models/mdm/module/detail_spec.rb +75 -184
- data/spec/app/models/mdm/module/mixin_spec.rb +12 -10
- data/spec/app/models/mdm/module/platform_spec.rb +12 -10
- data/spec/app/models/mdm/module/ref_spec.rb +12 -10
- data/spec/app/models/mdm/module/target_spec.rb +15 -13
- data/spec/app/models/mdm/nexpose_console_spec.rb +37 -35
- data/spec/app/models/mdm/note_spec.rb +25 -23
- data/spec/app/models/mdm/profile_spec.rb +3 -1
- data/spec/app/models/mdm/ref_spec.rb +12 -10
- data/spec/app/models/mdm/route_spec.rb +8 -6
- data/spec/app/models/mdm/service_spec.rb +40 -38
- data/spec/app/models/mdm/session_event_spec.rb +12 -10
- data/spec/app/models/mdm/session_spec.rb +15 -13
- data/spec/app/models/mdm/tag_spec.rb +29 -29
- data/spec/app/models/mdm/task_cred_spec.rb +11 -9
- data/spec/app/models/mdm/task_host_spec.rb +11 -9
- data/spec/app/models/mdm/task_service_spec.rb +11 -9
- data/spec/app/models/mdm/task_session_spec.rb +9 -7
- data/spec/app/models/mdm/task_spec.rb +29 -27
- data/spec/app/models/mdm/user_spec.rb +19 -17
- data/spec/app/models/mdm/vuln_attempt_spec.rb +16 -14
- data/spec/app/models/mdm/vuln_detail_spec.rb +28 -26
- data/spec/app/models/mdm/vuln_ref_spec.rb +10 -8
- data/spec/app/models/mdm/vuln_spec.rb +26 -24
- data/spec/app/models/mdm/web_form_spec.rb +13 -11
- data/spec/app/models/mdm/web_page_spec.rb +21 -19
- data/spec/app/models/mdm/web_site_spec.rb +23 -21
- data/spec/app/models/mdm/web_vuln_spec.rb +65 -63
- data/spec/app/models/mdm/wmap_request_spec.rb +3 -1
- data/spec/app/models/mdm/wmap_target_spec.rb +3 -1
- data/spec/app/models/mdm/workspace_spec.rb +100 -97
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +5 -3
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +15 -13
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +12 -10
- data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +23 -21
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +11 -9
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +23 -21
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +15 -22
- data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +20 -18
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +8 -6
- data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +4 -2
- data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +8 -6
- data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +11 -9
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +7 -5
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +19 -17
- data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +7 -5
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +23 -61
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +10 -8
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +46 -54
- data/spec/factories/mdm/module/details.rb +1 -1
- data/spec/lib/base64_serializer_spec.rb +19 -19
- data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +12 -18
- data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +6 -4
- data/spec/lib/metasploit_data_models/match/child_spec.rb +4 -2
- data/spec/lib/metasploit_data_models/match/parent_spec.rb +6 -4
- data/spec/lib/metasploit_data_models/version_spec.rb +5 -3
- data/spec/spec_helper.rb +6 -72
- data/spec/support/shared/examples/mdm/module/detail/does_not_support_stance_with_mtype.rb +2 -2
- data/spec/support/shared/examples/mdm/module/detail/supports_stance_with_mtype.rb +4 -4
- data/spec/support/shared/examples/metasploit_data_models/search/operation/ipaddress/match.rb +2 -2
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_metasploit_model_search_operation_base.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_equality.rb +3 -3
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_metasploit_model_search_group_base.rb +6 -7
- metadata +7 -7
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::IPAddress::V4::CIDR do
|
2
4
|
subject(:cidr) {
|
3
5
|
described_class.new(
|
4
6
|
value: formatted_value
|
@@ -9,14 +11,14 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::CIDR, type: :model do
|
|
9
11
|
nil
|
10
12
|
}
|
11
13
|
|
12
|
-
it {
|
14
|
+
it { should be_a MetasploitDataModels::IPAddress::CIDR }
|
13
15
|
|
14
16
|
context 'address_class' do
|
15
17
|
subject(:address_class) {
|
16
18
|
described_class.address_class
|
17
19
|
}
|
18
20
|
|
19
|
-
it {
|
21
|
+
it { should == MetasploitDataModels::IPAddress::V4::Single }
|
20
22
|
end
|
21
23
|
|
22
24
|
context 'validations' do
|
@@ -33,7 +35,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::CIDR, type: :model do
|
|
33
35
|
"#{formatted_address}/#{formatted_prefix_length}"
|
34
36
|
}
|
35
37
|
|
36
|
-
it {
|
38
|
+
it { should be_valid }
|
37
39
|
end
|
38
40
|
|
39
41
|
context 'with IPv4 address' do
|
@@ -41,7 +43,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::CIDR, type: :model do
|
|
41
43
|
formatted_address
|
42
44
|
}
|
43
45
|
|
44
|
-
it {
|
46
|
+
it { should_not be_valid }
|
45
47
|
|
46
48
|
context 'errors' do
|
47
49
|
before(:each) do
|
@@ -53,7 +55,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::CIDR, type: :model do
|
|
53
55
|
cidr.errors[:address]
|
54
56
|
}
|
55
57
|
|
56
|
-
it {
|
58
|
+
it { should be_empty }
|
57
59
|
end
|
58
60
|
|
59
61
|
context 'on #prefix_length' do
|
@@ -65,7 +67,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::CIDR, type: :model do
|
|
65
67
|
I18n.translate!('errors.messages.not_a_number')
|
66
68
|
}
|
67
69
|
|
68
|
-
it {
|
70
|
+
it { should include(blank_error) }
|
69
71
|
end
|
70
72
|
end
|
71
73
|
end
|
@@ -83,7 +85,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::CIDR, type: :model do
|
|
83
85
|
'48'
|
84
86
|
}
|
85
87
|
|
86
|
-
it {
|
88
|
+
it { should_not be_valid }
|
87
89
|
|
88
90
|
context 'errors' do
|
89
91
|
before(:each) do
|
@@ -99,7 +101,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::CIDR, type: :model do
|
|
99
101
|
I18n.translate!('errors.messages.invalid')
|
100
102
|
}
|
101
103
|
|
102
|
-
it {
|
104
|
+
it { should include(invalid_error) }
|
103
105
|
end
|
104
106
|
|
105
107
|
context 'on #prefix_length' do
|
@@ -111,7 +113,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::CIDR, type: :model do
|
|
111
113
|
I18n.translate!('errors.messages.less_than_or_equal_to', count: 32)
|
112
114
|
}
|
113
115
|
|
114
|
-
it {
|
116
|
+
it { should include(too_big_error) }
|
115
117
|
end
|
116
118
|
end
|
117
119
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::IPAddress::V4::Nmap do
|
2
4
|
subject(:nmap) {
|
3
5
|
described_class.new(
|
4
6
|
value: formatted_value
|
@@ -39,7 +41,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Nmap, type: :model do
|
|
39
41
|
'1.2.3.4'
|
40
42
|
}
|
41
43
|
|
42
|
-
it {
|
44
|
+
it { should be_empty }
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
@@ -55,7 +57,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Nmap, type: :model do
|
|
55
57
|
)
|
56
58
|
}
|
57
59
|
|
58
|
-
it {
|
60
|
+
it { should include length_error }
|
59
61
|
end
|
60
62
|
end
|
61
63
|
end
|
@@ -84,7 +86,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Nmap, type: :model do
|
|
84
86
|
nil
|
85
87
|
}
|
86
88
|
|
87
|
-
it {
|
89
|
+
it { should be_nil }
|
88
90
|
end
|
89
91
|
|
90
92
|
context 'with matching formatted value' do
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::IPAddress::V4::Range do
|
2
4
|
subject(:range) {
|
3
5
|
described_class.new(
|
4
6
|
value: formatted_value
|
@@ -45,7 +47,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
45
47
|
nil
|
46
48
|
}
|
47
49
|
|
48
|
-
it {
|
50
|
+
it { should include presence_error }
|
49
51
|
end
|
50
52
|
|
51
53
|
context 'with MetasploitDataModels::IPAddress::V4::Single' do
|
@@ -54,7 +56,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
54
56
|
'1.1.1.1-256.256.256.256'
|
55
57
|
}
|
56
58
|
|
57
|
-
it {
|
59
|
+
it { should_not include invalid_error }
|
58
60
|
end
|
59
61
|
|
60
62
|
context 'without valid' do
|
@@ -62,7 +64,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
62
64
|
'256.256.256.256-257.257.257.257'
|
63
65
|
}
|
64
66
|
|
65
|
-
it {
|
67
|
+
it { should include invalid_error }
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
@@ -79,7 +81,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
79
81
|
nil
|
80
82
|
}
|
81
83
|
|
82
|
-
it {
|
84
|
+
it { should include presence_error }
|
83
85
|
end
|
84
86
|
|
85
87
|
context 'with MetasploitDataModels::IPAddress::V4::Single' do
|
@@ -88,7 +90,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
88
90
|
'256.256.256.256-1.1.1.1'
|
89
91
|
}
|
90
92
|
|
91
|
-
it {
|
93
|
+
it { should_not include invalid_error }
|
92
94
|
end
|
93
95
|
|
94
96
|
context 'without valid' do
|
@@ -96,7 +98,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
96
98
|
'257.257.257.257-256.256.256.256'
|
97
99
|
}
|
98
100
|
|
99
|
-
it {
|
101
|
+
it { should include invalid_error }
|
100
102
|
end
|
101
103
|
end
|
102
104
|
end
|
@@ -120,7 +122,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
120
122
|
nil
|
121
123
|
}
|
122
124
|
|
123
|
-
it {
|
125
|
+
it { should_not include error }
|
124
126
|
end
|
125
127
|
|
126
128
|
context 'with incomparables' do
|
@@ -128,7 +130,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
128
130
|
'a-1'
|
129
131
|
}
|
130
132
|
|
131
|
-
it {
|
133
|
+
it { should_not include error }
|
132
134
|
end
|
133
135
|
|
134
136
|
context 'with numbers' do
|
@@ -137,7 +139,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
137
139
|
'1.1.1.1-2.2.2.2'
|
138
140
|
}
|
139
141
|
|
140
|
-
it {
|
142
|
+
it { should_not include error }
|
141
143
|
end
|
142
144
|
|
143
145
|
context 'out of order' do
|
@@ -145,7 +147,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
145
147
|
'2.2.2.2-1.1.1.1'
|
146
148
|
}
|
147
149
|
|
148
|
-
it {
|
150
|
+
it { should include error }
|
149
151
|
end
|
150
152
|
end
|
151
153
|
end
|
@@ -204,7 +206,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
204
206
|
'1..2'
|
205
207
|
}
|
206
208
|
|
207
|
-
it {
|
209
|
+
it { should == '-' }
|
208
210
|
end
|
209
211
|
end
|
210
212
|
|
@@ -219,14 +221,14 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
219
221
|
'1.1.1.1-2.2.2.2'
|
220
222
|
}
|
221
223
|
|
222
|
-
it {
|
224
|
+
it { should be_a Range }
|
223
225
|
|
224
226
|
context 'Range#begin' do
|
225
227
|
subject(:range_begin) {
|
226
228
|
value.begin
|
227
229
|
}
|
228
230
|
|
229
|
-
it {
|
231
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Single }
|
230
232
|
|
231
233
|
it "is value before '-'" do
|
232
234
|
expect(range_begin).to eq(MetasploitDataModels::IPAddress::V4::Single.new(value: '1.1.1.1'))
|
@@ -238,7 +240,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
238
240
|
value.end
|
239
241
|
}
|
240
242
|
|
241
|
-
it {
|
243
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Single }
|
242
244
|
|
243
245
|
it "is value after '-'" do
|
244
246
|
expect(range_end).to eq(MetasploitDataModels::IPAddress::V4::Single.new(value: '2.2.2.2'))
|
@@ -251,21 +253,21 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
251
253
|
'-'
|
252
254
|
}
|
253
255
|
|
254
|
-
it {
|
256
|
+
it { should be_a Range }
|
255
257
|
|
256
258
|
context 'Range#begin' do
|
257
259
|
subject(:range_begin) {
|
258
260
|
value.begin
|
259
261
|
}
|
260
262
|
|
261
|
-
it {
|
263
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Single }
|
262
264
|
|
263
265
|
context 'MetasploitDataModels::IPAddress::V4::Single#value' do
|
264
266
|
subject(:begin_value) {
|
265
267
|
range_begin.value
|
266
268
|
}
|
267
269
|
|
268
|
-
it {
|
270
|
+
it { should == '' }
|
269
271
|
end
|
270
272
|
end
|
271
273
|
|
@@ -274,14 +276,14 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
274
276
|
value.end
|
275
277
|
}
|
276
278
|
|
277
|
-
it {
|
279
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Single }
|
278
280
|
|
279
281
|
context 'MetasploitDataModels::IPAddress::V4::Single#value' do
|
280
282
|
subject(:end_value) {
|
281
283
|
range_end.value
|
282
284
|
}
|
283
285
|
|
284
|
-
it {
|
286
|
+
it { should == '' }
|
285
287
|
end
|
286
288
|
end
|
287
289
|
end
|
@@ -292,7 +294,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Range, type: :model do
|
|
292
294
|
'1'
|
293
295
|
end
|
294
296
|
|
295
|
-
it {
|
297
|
+
it { should_not be_a Range }
|
296
298
|
end
|
297
299
|
end
|
298
300
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List do
|
2
4
|
subject(:nmap) {
|
3
5
|
described_class.new(
|
4
6
|
value: formatted_value
|
@@ -66,7 +68,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
|
|
66
68
|
described_class::SEPARATOR
|
67
69
|
}
|
68
70
|
|
69
|
-
it {
|
71
|
+
it { should == ',' }
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
@@ -89,7 +91,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
|
|
89
91
|
nil
|
90
92
|
}
|
91
93
|
|
92
|
-
it {
|
94
|
+
it { should include blank_error }
|
93
95
|
end
|
94
96
|
|
95
97
|
context 'with matching String' do
|
@@ -98,7 +100,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
|
|
98
100
|
'1,2-3'
|
99
101
|
}
|
100
102
|
|
101
|
-
it {
|
103
|
+
it { should be_empty }
|
102
104
|
end
|
103
105
|
|
104
106
|
context 'with invalid MetasploitDataModels::IPAddress::V4::Nmap::Range' do
|
@@ -129,7 +131,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
|
|
129
131
|
'non_matching_string'
|
130
132
|
}
|
131
133
|
|
132
|
-
it {
|
134
|
+
it { should include array_error }
|
133
135
|
end
|
134
136
|
end
|
135
137
|
end
|
@@ -183,7 +185,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
|
|
183
185
|
value.first
|
184
186
|
}
|
185
187
|
|
186
|
-
it {
|
188
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Segment::Single }
|
187
189
|
|
188
190
|
context 'MetasploitDataModels::IPAddress::V4::Segment::Single#value' do
|
189
191
|
it 'is value from formatted_value' do
|
@@ -215,7 +217,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
|
|
215
217
|
value.first
|
216
218
|
}
|
217
219
|
|
218
|
-
it {
|
220
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range }
|
219
221
|
|
220
222
|
context 'MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range#value' do
|
221
223
|
subject(:element_value) {
|
@@ -227,7 +229,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
|
|
227
229
|
element_value.begin
|
228
230
|
}
|
229
231
|
|
230
|
-
it {
|
232
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Segment::Single }
|
231
233
|
|
232
234
|
context 'MetasploitDataModels::IPAddress::V4::Segment::Single#value' do
|
233
235
|
it 'is beginning of formatted value' do
|
@@ -241,7 +243,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::List, type: :
|
|
241
243
|
element_value.end
|
242
244
|
}
|
243
245
|
|
244
|
-
it {
|
246
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Segment::Single }
|
245
247
|
|
246
248
|
context 'MetasploitDataModels::IPAddress::V4::Segment::Single#value' do
|
247
249
|
it 'is beginning of formatted value' do
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range do
|
2
4
|
subject(:range) {
|
3
5
|
described_class.new(
|
4
6
|
value: formatted_value
|
@@ -45,7 +47,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
45
47
|
nil
|
46
48
|
}
|
47
49
|
|
48
|
-
it {
|
50
|
+
it { should include presence_error }
|
49
51
|
end
|
50
52
|
|
51
53
|
context 'with MetasploitDataModels::IPAddress::V4::Segment' do
|
@@ -54,7 +56,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
54
56
|
'1-256'
|
55
57
|
}
|
56
58
|
|
57
|
-
it {
|
59
|
+
it { should_not include invalid_error }
|
58
60
|
end
|
59
61
|
|
60
62
|
context 'without valid' do
|
@@ -62,7 +64,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
62
64
|
'256-257'
|
63
65
|
}
|
64
66
|
|
65
|
-
it {
|
67
|
+
it { should include invalid_error }
|
66
68
|
end
|
67
69
|
end
|
68
70
|
end
|
@@ -79,7 +81,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
79
81
|
nil
|
80
82
|
}
|
81
83
|
|
82
|
-
it {
|
84
|
+
it { should include presence_error }
|
83
85
|
end
|
84
86
|
|
85
87
|
context 'with MetasploitDataModels::IPAddress::V4::Segment' do
|
@@ -88,7 +90,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
88
90
|
'256-1'
|
89
91
|
}
|
90
92
|
|
91
|
-
it {
|
93
|
+
it { should_not include invalid_error }
|
92
94
|
end
|
93
95
|
|
94
96
|
context 'without valid' do
|
@@ -96,7 +98,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
96
98
|
'257-256'
|
97
99
|
}
|
98
100
|
|
99
|
-
it {
|
101
|
+
it { should include invalid_error }
|
100
102
|
end
|
101
103
|
end
|
102
104
|
end
|
@@ -120,7 +122,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
120
122
|
nil
|
121
123
|
}
|
122
124
|
|
123
|
-
it {
|
125
|
+
it { should_not include error }
|
124
126
|
end
|
125
127
|
|
126
128
|
context 'with incomparables' do
|
@@ -128,7 +130,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
128
130
|
'a-1'
|
129
131
|
}
|
130
132
|
|
131
|
-
it {
|
133
|
+
it { should_not include error }
|
132
134
|
end
|
133
135
|
|
134
136
|
context 'with numbers' do
|
@@ -137,7 +139,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
137
139
|
'1-2'
|
138
140
|
}
|
139
141
|
|
140
|
-
it {
|
142
|
+
it { should_not include error }
|
141
143
|
end
|
142
144
|
|
143
145
|
context 'out of order' do
|
@@ -145,7 +147,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
145
147
|
'2-1'
|
146
148
|
}
|
147
149
|
|
148
|
-
it {
|
150
|
+
it { should include error }
|
149
151
|
end
|
150
152
|
end
|
151
153
|
end
|
@@ -204,7 +206,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
204
206
|
'1..2'
|
205
207
|
}
|
206
208
|
|
207
|
-
it {
|
209
|
+
it { should == '-' }
|
208
210
|
end
|
209
211
|
end
|
210
212
|
|
@@ -219,14 +221,14 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
219
221
|
'1-2'
|
220
222
|
}
|
221
223
|
|
222
|
-
it {
|
224
|
+
it { should be_a Range }
|
223
225
|
|
224
226
|
context 'Range#begin' do
|
225
227
|
subject(:range_begin) {
|
226
228
|
value.begin
|
227
229
|
}
|
228
230
|
|
229
|
-
it {
|
231
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Segment::Single }
|
230
232
|
|
231
233
|
context 'MetasploitDataModels::IPAddress::V4::Segment::Single#value' do
|
232
234
|
it "is value before '-'" do
|
@@ -240,7 +242,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
240
242
|
value.end
|
241
243
|
}
|
242
244
|
|
243
|
-
it {
|
245
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Segment::Single }
|
244
246
|
|
245
247
|
context 'MetasploitDataModels::IPAddress::V4::Segment::Single#value' do
|
246
248
|
it "is value after '-'" do
|
@@ -255,21 +257,21 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
255
257
|
'-'
|
256
258
|
}
|
257
259
|
|
258
|
-
it {
|
260
|
+
it { should be_a Range }
|
259
261
|
|
260
262
|
context 'Range#begin' do
|
261
263
|
subject(:range_begin) {
|
262
264
|
value.begin
|
263
265
|
}
|
264
266
|
|
265
|
-
it {
|
267
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Segment::Single }
|
266
268
|
|
267
269
|
context 'MetasploitDataModels::IPAddress::V4::Segment::Single#value' do
|
268
270
|
subject(:begin_value) {
|
269
271
|
range_begin.value
|
270
272
|
}
|
271
273
|
|
272
|
-
it {
|
274
|
+
it { should == '' }
|
273
275
|
end
|
274
276
|
end
|
275
277
|
|
@@ -278,14 +280,14 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
278
280
|
value.end
|
279
281
|
}
|
280
282
|
|
281
|
-
it {
|
283
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Segment::Single }
|
282
284
|
|
283
285
|
context 'MetasploitDataModels::IPAddress::V4::Segment::Single#value' do
|
284
286
|
subject(:end_value) {
|
285
287
|
range_end.value
|
286
288
|
}
|
287
289
|
|
288
|
-
it {
|
290
|
+
it { should == '' }
|
289
291
|
end
|
290
292
|
end
|
291
293
|
end
|
@@ -296,7 +298,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Nmap::Range, type:
|
|
296
298
|
'1'
|
297
299
|
end
|
298
300
|
|
299
|
-
it {
|
301
|
+
it { should_not be_a Range }
|
300
302
|
end
|
301
303
|
end
|
302
304
|
end
|