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,11 +1,13 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::IPAddress::V4::Segmented do
|
2
4
|
context 'CONSTANTS' do
|
3
5
|
context 'SEGMENT_COUNT' do
|
4
6
|
subject(:segment_count) {
|
5
7
|
described_class::SEGMENT_COUNT
|
6
8
|
}
|
7
9
|
|
8
|
-
it {
|
10
|
+
it { should == 4 }
|
9
11
|
end
|
10
12
|
|
11
13
|
context 'SEPARATOR' do
|
@@ -13,7 +15,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segmented, type: :model do
|
|
13
15
|
described_class::SEPARATOR
|
14
16
|
}
|
15
17
|
|
16
|
-
it {
|
18
|
+
it { should == '.' }
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
@@ -22,6 +24,6 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segmented, type: :model do
|
|
22
24
|
described_class.segment_count
|
23
25
|
}
|
24
26
|
|
25
|
-
it {
|
27
|
+
it { should == 4 }
|
26
28
|
end
|
27
29
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
2
4
|
subject(:single) {
|
3
5
|
described_class.new(
|
4
6
|
value: formatted_value
|
@@ -10,7 +12,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
10
12
|
}
|
11
13
|
|
12
14
|
context 'validations' do
|
13
|
-
it {
|
15
|
+
it { should validate_numericality_of(:value).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(255).only_integer }
|
14
16
|
end
|
15
17
|
|
16
18
|
it 'can be used in a Range' do
|
@@ -135,7 +137,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
135
137
|
described_class.bits
|
136
138
|
}
|
137
139
|
|
138
|
-
it {
|
140
|
+
it { should == 8 }
|
139
141
|
end
|
140
142
|
|
141
143
|
context 'match_regexp' do
|
@@ -157,22 +159,15 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
157
159
|
single <=> other
|
158
160
|
}
|
159
161
|
|
160
|
-
let(:formatted_value) {
|
161
|
-
'1'
|
162
|
-
}
|
163
|
-
|
164
162
|
let(:other) {
|
165
163
|
double('Other')
|
166
164
|
}
|
167
165
|
|
168
166
|
it 'compares #values' do
|
169
167
|
other_value = double('other.value')
|
170
|
-
single_value = double('single.value')
|
171
168
|
|
172
169
|
expect(other).to receive(:value).and_return(other_value)
|
173
|
-
|
174
|
-
expect(single).to receive(:value).and_return(single_value)
|
175
|
-
expect(single_value).to receive(:<=>).with(other_value)
|
170
|
+
expect(single.value).to receive(:<=>).with(other_value)
|
176
171
|
|
177
172
|
compare
|
178
173
|
end
|
@@ -190,9 +185,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
190
185
|
}
|
191
186
|
|
192
187
|
specify {
|
193
|
-
expect
|
194
|
-
succ
|
195
|
-
}.not_to raise_error
|
188
|
+
expect(succ).not_to raise_error
|
196
189
|
}
|
197
190
|
end
|
198
191
|
|
@@ -205,7 +198,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
205
198
|
1
|
206
199
|
}
|
207
200
|
|
208
|
-
it {
|
201
|
+
it { should be_a described_class }
|
209
202
|
|
210
203
|
context 'succ.value' do
|
211
204
|
it 'is succ of #value' do
|
@@ -219,7 +212,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
219
212
|
'a'
|
220
213
|
}
|
221
214
|
|
222
|
-
it {
|
215
|
+
it { should be_a described_class }
|
223
216
|
|
224
217
|
context 'succ.value' do
|
225
218
|
it 'is succ of #value' do
|
@@ -269,7 +262,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
269
262
|
end
|
270
263
|
|
271
264
|
it 'should pass through Integer' do
|
272
|
-
|
265
|
+
value.should == formatted_value
|
273
266
|
end
|
274
267
|
end
|
275
268
|
|
@@ -283,7 +276,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
283
276
|
end
|
284
277
|
|
285
278
|
it 'should convert String to Integer' do
|
286
|
-
|
279
|
+
value.should == integer
|
287
280
|
end
|
288
281
|
end
|
289
282
|
|
@@ -297,11 +290,11 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
297
290
|
end
|
298
291
|
|
299
292
|
it 'should not extract the number' do
|
300
|
-
|
293
|
+
value.should_not == integer
|
301
294
|
end
|
302
295
|
|
303
296
|
it 'should pass through the full value' do
|
304
|
-
|
297
|
+
value.should == formatted_value
|
305
298
|
end
|
306
299
|
end
|
307
300
|
|
@@ -311,11 +304,11 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :mode
|
|
311
304
|
end
|
312
305
|
|
313
306
|
it 'should not truncate Float to Integer' do
|
314
|
-
|
307
|
+
value.should_not == formatted_value.to_i
|
315
308
|
end
|
316
309
|
|
317
310
|
it 'should pass through Float' do
|
318
|
-
|
311
|
+
value.should == formatted_value
|
319
312
|
end
|
320
313
|
end
|
321
314
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::IPAddress::V4::Single do
|
2
4
|
subject(:single) {
|
3
5
|
described_class.new(
|
4
6
|
value: formatted_value
|
@@ -20,7 +22,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Single, type: :model do
|
|
20
22
|
'1.2.3.4'
|
21
23
|
}
|
22
24
|
|
23
|
-
it {
|
25
|
+
it { should be_empty }
|
24
26
|
end
|
25
27
|
|
26
28
|
context 'without segments' do
|
@@ -35,7 +37,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Single, type: :model do
|
|
35
37
|
)
|
36
38
|
}
|
37
39
|
|
38
|
-
it {
|
40
|
+
it { should include length_error }
|
39
41
|
end
|
40
42
|
end
|
41
43
|
end
|
@@ -140,7 +142,7 @@ RSpec.describe MetasploitDataModels::IPAddress::V4::Single, type: :model do
|
|
140
142
|
nil
|
141
143
|
}
|
142
144
|
|
143
|
-
it {
|
145
|
+
it { should be_nil }
|
144
146
|
end
|
145
147
|
|
146
148
|
context 'with matching formatted value' do
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::Search::Operation::IPAddress do
|
2
4
|
subject(:operation) {
|
3
5
|
described_class.new(
|
4
6
|
operator: operator,
|
@@ -43,7 +45,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
43
45
|
'1.2.3.4/8'
|
44
46
|
}
|
45
47
|
|
46
|
-
it {
|
48
|
+
it { should be_empty }
|
47
49
|
end
|
48
50
|
|
49
51
|
context 'without valid prefix_length' do
|
@@ -51,17 +53,17 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
51
53
|
'1.2.3.4/36'
|
52
54
|
}
|
53
55
|
|
54
|
-
it {
|
56
|
+
it { should include invalid_error }
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
58
|
-
context 'with Nmap' do
|
59
|
-
context 'with valid segment range'
|
60
|
+
context 'with Nmap', pending: 'MSP-10712' do
|
61
|
+
context 'with valid segment range' do
|
60
62
|
let(:formatted_value) {
|
61
63
|
'1-2.3.4.5'
|
62
64
|
}
|
63
65
|
|
64
|
-
it {
|
66
|
+
it { should be_empty }
|
65
67
|
end
|
66
68
|
|
67
69
|
context 'without valid segment range' do
|
@@ -69,7 +71,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
69
71
|
'2-1.3.4.5'
|
70
72
|
}
|
71
73
|
|
72
|
-
it {
|
74
|
+
it { should include invalid_error }
|
73
75
|
end
|
74
76
|
end
|
75
77
|
|
@@ -79,7 +81,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
79
81
|
'2.2.2.2-1.1.1.1'
|
80
82
|
}
|
81
83
|
|
82
|
-
it {
|
84
|
+
it { should include invalid_error }
|
83
85
|
end
|
84
86
|
|
85
87
|
context 'without ordered range' do
|
@@ -87,7 +89,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
87
89
|
'1.1.1.1-2.2.2.2'
|
88
90
|
}
|
89
91
|
|
90
|
-
it {
|
92
|
+
it { should be_empty }
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
@@ -105,8 +107,8 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
105
107
|
nil
|
106
108
|
}
|
107
109
|
|
108
|
-
it {
|
109
|
-
it {
|
110
|
+
it { should include blank_error }
|
111
|
+
it { should_not include invalid_error }
|
110
112
|
end
|
111
113
|
|
112
114
|
context 'with empty string' do
|
@@ -114,8 +116,8 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
114
116
|
''
|
115
117
|
}
|
116
118
|
|
117
|
-
it {
|
118
|
-
it {
|
119
|
+
it { should include blank_error }
|
120
|
+
it { should_not include invalid_error }
|
119
121
|
end
|
120
122
|
|
121
123
|
context 'without matching formatted value' do
|
@@ -123,7 +125,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
123
125
|
'non_matching_value'
|
124
126
|
}
|
125
127
|
|
126
|
-
it {
|
128
|
+
it { should include invalid_error }
|
127
129
|
end
|
128
130
|
end
|
129
131
|
end
|
@@ -139,7 +141,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
139
141
|
'1.2.3.4/8'
|
140
142
|
}
|
141
143
|
|
142
|
-
it {
|
144
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::CIDR }
|
143
145
|
end
|
144
146
|
|
145
147
|
context 'with Nmap', pending: 'MSP-10712' do
|
@@ -147,7 +149,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
147
149
|
'1.2.3.4-5'
|
148
150
|
}
|
149
151
|
|
150
|
-
it {
|
152
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Nmap }
|
151
153
|
end
|
152
154
|
|
153
155
|
context 'with Range' do
|
@@ -155,7 +157,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
155
157
|
'1.1.1.1-2.2.2.2'
|
156
158
|
}
|
157
159
|
|
158
|
-
it {
|
160
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Range }
|
159
161
|
end
|
160
162
|
|
161
163
|
context 'with address' do
|
@@ -163,7 +165,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model
|
|
163
165
|
'1.2.3.4'
|
164
166
|
}
|
165
167
|
|
166
|
-
it {
|
168
|
+
it { should be_a MetasploitDataModels::IPAddress::V4::Single }
|
167
169
|
end
|
168
170
|
end
|
169
171
|
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::Search::Operation::Port::Number do
|
2
4
|
context 'CONSTANTS' do
|
3
5
|
context 'BITS' do
|
4
6
|
subject(:bits) {
|
5
7
|
described_class::BITS
|
6
8
|
}
|
7
9
|
|
8
|
-
it {
|
10
|
+
it { should == 16 }
|
9
11
|
end
|
10
12
|
|
11
13
|
context 'MAXIMUM' do
|
@@ -13,7 +15,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Number, type: :mod
|
|
13
15
|
described_class::MAXIMUM
|
14
16
|
}
|
15
17
|
|
16
|
-
it {
|
18
|
+
it { should == 65535 }
|
17
19
|
end
|
18
20
|
|
19
21
|
context 'MINIMUM' do
|
@@ -21,7 +23,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Number, type: :mod
|
|
21
23
|
described_class::MINIMUM
|
22
24
|
}
|
23
25
|
|
24
|
-
it {
|
26
|
+
it { should == 0 }
|
25
27
|
end
|
26
28
|
|
27
29
|
context 'RANGE' do
|
@@ -29,11 +31,11 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Number, type: :mod
|
|
29
31
|
described_class::RANGE
|
30
32
|
}
|
31
33
|
|
32
|
-
it {
|
34
|
+
it { should == (0..65535) }
|
33
35
|
end
|
34
36
|
end
|
35
37
|
|
36
38
|
context 'validations' do
|
37
|
-
it {
|
39
|
+
it { should ensure_inclusion_of(:value).in_range(described_class::RANGE) }
|
38
40
|
end
|
39
41
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::Search::Operation::Port::Range do
|
2
4
|
subject(:port_range_operation) {
|
3
5
|
described_class.new(
|
4
6
|
value: formatted_value
|
@@ -9,7 +11,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Range, type: :mode
|
|
9
11
|
'1'
|
10
12
|
}
|
11
13
|
|
12
|
-
it {
|
14
|
+
it { should be_a MetasploitDataModels::Search::Operation::Range }
|
13
15
|
|
14
16
|
context 'validations' do
|
15
17
|
before(:each) do
|
@@ -28,7 +30,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Range, type: :mode
|
|
28
30
|
'1-2'
|
29
31
|
}
|
30
32
|
|
31
|
-
it {
|
33
|
+
it { should be_empty }
|
32
34
|
end
|
33
35
|
|
34
36
|
# this can't actually happen because the minimum is 0 and a negative number can't be parsed, but validation
|
@@ -62,7 +64,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Range, type: :mode
|
|
62
64
|
1
|
63
65
|
}
|
64
66
|
|
65
|
-
it {
|
67
|
+
it { should include error }
|
66
68
|
end
|
67
69
|
|
68
70
|
context 'without Range#begin covered by MetasploitDataModels::Search::Operation::Port::Number::RANGE' do
|
@@ -84,7 +86,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Range, type: :mode
|
|
84
86
|
MetasploitDataModels::Search::Operation::Port::Number::MAXIMUM + 1
|
85
87
|
}
|
86
88
|
|
87
|
-
it {
|
89
|
+
it { should include error }
|
88
90
|
end
|
89
91
|
end
|
90
92
|
|
@@ -117,8 +119,8 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Range, type: :mode
|
|
117
119
|
'b'
|
118
120
|
}
|
119
121
|
|
120
|
-
it {
|
121
|
-
it {
|
122
|
+
it { should include begin_error }
|
123
|
+
it { should include end_error }
|
122
124
|
end
|
123
125
|
end
|
124
126
|
|
@@ -131,7 +133,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Port::Range, type: :mode
|
|
131
133
|
'1'
|
132
134
|
}
|
133
135
|
|
134
|
-
it {
|
136
|
+
it { should include(error) }
|
135
137
|
end
|
136
138
|
end
|
137
139
|
end
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe MetasploitDataModels::Search::Operation::Range do
|
2
4
|
subject(:range_operation) {
|
3
5
|
described_class.new(attributes)
|
4
6
|
}
|
@@ -9,7 +11,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
|
|
9
11
|
described_class::SEPARATOR
|
10
12
|
}
|
11
13
|
|
12
|
-
it {
|
14
|
+
it { should == '-' }
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
@@ -55,7 +57,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
|
|
55
57
|
'1-2'
|
56
58
|
}
|
57
59
|
|
58
|
-
it {
|
60
|
+
it { should_not include(error) }
|
59
61
|
end
|
60
62
|
|
61
63
|
context 'with begin same as end' do
|
@@ -70,7 +72,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
|
|
70
72
|
'1-1'
|
71
73
|
}
|
72
74
|
|
73
|
-
it {
|
75
|
+
it { should_not include(error) }
|
74
76
|
end
|
75
77
|
|
76
78
|
context 'with begin after end' do
|
@@ -85,7 +87,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
|
|
85
87
|
'2-1'
|
86
88
|
}
|
87
89
|
|
88
|
-
it {
|
90
|
+
it { should include error }
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
@@ -101,7 +103,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
|
|
101
103
|
'1..2'
|
102
104
|
}
|
103
105
|
|
104
|
-
it {
|
106
|
+
it { should_not include(error) }
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
@@ -111,7 +113,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
|
|
111
113
|
'1-2'
|
112
114
|
}
|
113
115
|
|
114
|
-
it {
|
116
|
+
it { should be_empty }
|
115
117
|
end
|
116
118
|
|
117
119
|
context 'without Range' do
|
@@ -123,7 +125,7 @@ RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
|
|
123
125
|
'1..2'
|
124
126
|
}
|
125
127
|
|
126
|
-
it {
|
128
|
+
it { should include error }
|
127
129
|
end
|
128
130
|
end
|
129
131
|
end
|