metasploit_data_models 0.24.0 → 0.24.1.pre.rspec.pre.3.pre.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 +1 -3
- 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 +0 -10
- data/lib/metasploit_data_models/version.rb +2 -2
- data/metasploit_data_models.gemspec +1 -1
- data/spec/app/models/mdm/api_key_spec.rb +1 -3
- data/spec/app/models/mdm/client_spec.rb +9 -11
- data/spec/app/models/mdm/cred_spec.rb +42 -54
- data/spec/app/models/mdm/event_spec.rb +21 -23
- data/spec/app/models/mdm/exploit_attempt_spec.rb +19 -21
- data/spec/app/models/mdm/exploited_host_spec.rb +11 -13
- data/spec/app/models/mdm/host_detail_spec.rb +15 -17
- data/spec/app/models/mdm/host_spec.rb +261 -260
- data/spec/app/models/mdm/host_tag_spec.rb +6 -8
- data/spec/app/models/mdm/listener_spec.rb +30 -32
- data/spec/app/models/mdm/loot_spec.rb +21 -23
- data/spec/app/models/mdm/macro_spec.rb +1 -3
- data/spec/app/models/mdm/mod_ref_spec.rb +1 -3
- data/spec/app/models/mdm/module/action_spec.rb +10 -12
- data/spec/app/models/mdm/module/arch_spec.rb +10 -12
- data/spec/app/models/mdm/module/author_spec.rb +22 -17
- data/spec/app/models/mdm/module/detail_spec.rb +184 -75
- data/spec/app/models/mdm/module/mixin_spec.rb +10 -12
- data/spec/app/models/mdm/module/platform_spec.rb +10 -12
- data/spec/app/models/mdm/module/ref_spec.rb +10 -12
- data/spec/app/models/mdm/module/target_spec.rb +13 -15
- data/spec/app/models/mdm/nexpose_console_spec.rb +35 -37
- data/spec/app/models/mdm/note_spec.rb +23 -25
- data/spec/app/models/mdm/profile_spec.rb +1 -3
- data/spec/app/models/mdm/ref_spec.rb +10 -12
- data/spec/app/models/mdm/route_spec.rb +6 -8
- data/spec/app/models/mdm/service_spec.rb +38 -40
- data/spec/app/models/mdm/session_event_spec.rb +10 -12
- data/spec/app/models/mdm/session_spec.rb +13 -15
- data/spec/app/models/mdm/tag_spec.rb +29 -29
- data/spec/app/models/mdm/task_cred_spec.rb +9 -11
- data/spec/app/models/mdm/task_host_spec.rb +9 -11
- data/spec/app/models/mdm/task_service_spec.rb +9 -11
- data/spec/app/models/mdm/task_session_spec.rb +7 -9
- data/spec/app/models/mdm/task_spec.rb +27 -29
- data/spec/app/models/mdm/user_spec.rb +17 -19
- data/spec/app/models/mdm/vuln_attempt_spec.rb +14 -16
- data/spec/app/models/mdm/vuln_detail_spec.rb +26 -28
- data/spec/app/models/mdm/vuln_ref_spec.rb +8 -10
- data/spec/app/models/mdm/vuln_spec.rb +24 -26
- data/spec/app/models/mdm/web_form_spec.rb +11 -13
- data/spec/app/models/mdm/web_page_spec.rb +19 -21
- data/spec/app/models/mdm/web_site_spec.rb +21 -23
- data/spec/app/models/mdm/web_vuln_spec.rb +63 -65
- data/spec/app/models/mdm/wmap_request_spec.rb +1 -3
- data/spec/app/models/mdm/wmap_target_spec.rb +1 -3
- data/spec/app/models/mdm/workspace_spec.rb +97 -100
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +3 -5
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +13 -15
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +10 -12
- data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +21 -23
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +9 -11
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +21 -23
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +22 -15
- data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +18 -20
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +6 -8
- data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +2 -4
- data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +6 -8
- data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +9 -11
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +5 -7
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +17 -19
- data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +5 -7
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +61 -23
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +8 -10
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +54 -46
- data/spec/dummy/db/structure.sql +1 -0
- data/spec/lib/base64_serializer_spec.rb +19 -19
- data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +18 -12
- data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +4 -6
- data/spec/lib/metasploit_data_models/match/child_spec.rb +2 -4
- data/spec/lib/metasploit_data_models/match/parent_spec.rb +4 -6
- data/spec/lib/metasploit_data_models/version_spec.rb +3 -5
- data/spec/spec_helper.rb +72 -6
- 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 +7 -6
- metadata +6 -6
@@ -1,13 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::IPAddress::V4::Segmented do
|
1
|
+
RSpec.describe MetasploitDataModels::IPAddress::V4::Segmented, type: :model do
|
4
2
|
context 'CONSTANTS' do
|
5
3
|
context 'SEGMENT_COUNT' do
|
6
4
|
subject(:segment_count) {
|
7
5
|
described_class::SEGMENT_COUNT
|
8
6
|
}
|
9
7
|
|
10
|
-
it {
|
8
|
+
it { is_expected.to eq(4) }
|
11
9
|
end
|
12
10
|
|
13
11
|
context 'SEPARATOR' do
|
@@ -15,7 +13,7 @@ describe MetasploitDataModels::IPAddress::V4::Segmented do
|
|
15
13
|
described_class::SEPARATOR
|
16
14
|
}
|
17
15
|
|
18
|
-
it {
|
16
|
+
it { is_expected.to eq('.') }
|
19
17
|
end
|
20
18
|
end
|
21
19
|
|
@@ -24,6 +22,6 @@ describe MetasploitDataModels::IPAddress::V4::Segmented do
|
|
24
22
|
described_class.segment_count
|
25
23
|
}
|
26
24
|
|
27
|
-
it {
|
25
|
+
it { is_expected.to eq(4) }
|
28
26
|
end
|
29
27
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
1
|
+
RSpec.describe MetasploitDataModels::IPAddress::V4::Segment::Single, type: :model do
|
4
2
|
subject(:single) {
|
5
3
|
described_class.new(
|
6
4
|
value: formatted_value
|
@@ -12,7 +10,7 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
12
10
|
}
|
13
11
|
|
14
12
|
context 'validations' do
|
15
|
-
it {
|
13
|
+
it { is_expected.to validate_numericality_of(:value).is_greater_than_or_equal_to(0).is_less_than_or_equal_to(255).only_integer }
|
16
14
|
end
|
17
15
|
|
18
16
|
it 'can be used in a Range' do
|
@@ -137,7 +135,7 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
137
135
|
described_class.bits
|
138
136
|
}
|
139
137
|
|
140
|
-
it {
|
138
|
+
it { is_expected.to eq(8) }
|
141
139
|
end
|
142
140
|
|
143
141
|
context 'match_regexp' do
|
@@ -159,15 +157,22 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
159
157
|
single <=> other
|
160
158
|
}
|
161
159
|
|
160
|
+
let(:formatted_value) {
|
161
|
+
'1'
|
162
|
+
}
|
163
|
+
|
162
164
|
let(:other) {
|
163
165
|
double('Other')
|
164
166
|
}
|
165
167
|
|
166
168
|
it 'compares #values' do
|
167
169
|
other_value = double('other.value')
|
170
|
+
single_value = double('single.value')
|
168
171
|
|
169
172
|
expect(other).to receive(:value).and_return(other_value)
|
170
|
-
expect(
|
173
|
+
# have to use a double because can't expect().to receive on an Integer
|
174
|
+
expect(single).to receive(:value).and_return(single_value)
|
175
|
+
expect(single_value).to receive(:<=>).with(other_value)
|
171
176
|
|
172
177
|
compare
|
173
178
|
end
|
@@ -185,7 +190,9 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
185
190
|
}
|
186
191
|
|
187
192
|
specify {
|
188
|
-
expect
|
193
|
+
expect {
|
194
|
+
succ
|
195
|
+
}.not_to raise_error
|
189
196
|
}
|
190
197
|
end
|
191
198
|
|
@@ -198,7 +205,7 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
198
205
|
1
|
199
206
|
}
|
200
207
|
|
201
|
-
it {
|
208
|
+
it { is_expected.to be_a described_class }
|
202
209
|
|
203
210
|
context 'succ.value' do
|
204
211
|
it 'is succ of #value' do
|
@@ -212,7 +219,7 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
212
219
|
'a'
|
213
220
|
}
|
214
221
|
|
215
|
-
it {
|
222
|
+
it { is_expected.to be_a described_class }
|
216
223
|
|
217
224
|
context 'succ.value' do
|
218
225
|
it 'is succ of #value' do
|
@@ -262,7 +269,7 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
262
269
|
end
|
263
270
|
|
264
271
|
it 'should pass through Integer' do
|
265
|
-
value.
|
272
|
+
expect(value).to eq(formatted_value)
|
266
273
|
end
|
267
274
|
end
|
268
275
|
|
@@ -276,7 +283,7 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
276
283
|
end
|
277
284
|
|
278
285
|
it 'should convert String to Integer' do
|
279
|
-
value.
|
286
|
+
expect(value).to eq(integer)
|
280
287
|
end
|
281
288
|
end
|
282
289
|
|
@@ -290,11 +297,11 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
290
297
|
end
|
291
298
|
|
292
299
|
it 'should not extract the number' do
|
293
|
-
value.
|
300
|
+
expect(value).not_to eq(integer)
|
294
301
|
end
|
295
302
|
|
296
303
|
it 'should pass through the full value' do
|
297
|
-
value.
|
304
|
+
expect(value).to eq(formatted_value)
|
298
305
|
end
|
299
306
|
end
|
300
307
|
|
@@ -304,11 +311,11 @@ describe MetasploitDataModels::IPAddress::V4::Segment::Single do
|
|
304
311
|
end
|
305
312
|
|
306
313
|
it 'should not truncate Float to Integer' do
|
307
|
-
value.
|
314
|
+
expect(value).not_to eq(formatted_value.to_i)
|
308
315
|
end
|
309
316
|
|
310
317
|
it 'should pass through Float' do
|
311
|
-
value.
|
318
|
+
expect(value).to eq(formatted_value)
|
312
319
|
end
|
313
320
|
end
|
314
321
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::IPAddress::V4::Single do
|
1
|
+
RSpec.describe MetasploitDataModels::IPAddress::V4::Single, type: :model do
|
4
2
|
subject(:single) {
|
5
3
|
described_class.new(
|
6
4
|
value: formatted_value
|
@@ -22,7 +20,7 @@ describe MetasploitDataModels::IPAddress::V4::Single do
|
|
22
20
|
'1.2.3.4'
|
23
21
|
}
|
24
22
|
|
25
|
-
it {
|
23
|
+
it { is_expected.to be_empty }
|
26
24
|
end
|
27
25
|
|
28
26
|
context 'without segments' do
|
@@ -37,7 +35,7 @@ describe MetasploitDataModels::IPAddress::V4::Single do
|
|
37
35
|
)
|
38
36
|
}
|
39
37
|
|
40
|
-
it {
|
38
|
+
it { is_expected.to include length_error }
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
@@ -142,7 +140,7 @@ describe MetasploitDataModels::IPAddress::V4::Single do
|
|
142
140
|
nil
|
143
141
|
}
|
144
142
|
|
145
|
-
it {
|
143
|
+
it { is_expected.to be_nil }
|
146
144
|
end
|
147
145
|
|
148
146
|
context 'with matching formatted value' do
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::Search::Operation::IPAddress do
|
1
|
+
RSpec.describe MetasploitDataModels::Search::Operation::IPAddress, type: :model do
|
4
2
|
subject(:operation) {
|
5
3
|
described_class.new(
|
6
4
|
operator: operator,
|
@@ -45,7 +43,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
45
43
|
'1.2.3.4/8'
|
46
44
|
}
|
47
45
|
|
48
|
-
it {
|
46
|
+
it { is_expected.to be_empty }
|
49
47
|
end
|
50
48
|
|
51
49
|
context 'without valid prefix_length' do
|
@@ -53,17 +51,17 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
53
51
|
'1.2.3.4/36'
|
54
52
|
}
|
55
53
|
|
56
|
-
it {
|
54
|
+
it { is_expected.to include invalid_error }
|
57
55
|
end
|
58
56
|
end
|
59
57
|
|
60
|
-
context 'with Nmap'
|
61
|
-
context 'with valid segment range' do
|
58
|
+
context 'with Nmap' do
|
59
|
+
context 'with valid segment range', pending: 'MSP-10712' do
|
62
60
|
let(:formatted_value) {
|
63
61
|
'1-2.3.4.5'
|
64
62
|
}
|
65
63
|
|
66
|
-
it {
|
64
|
+
it { is_expected.to be_empty }
|
67
65
|
end
|
68
66
|
|
69
67
|
context 'without valid segment range' do
|
@@ -71,7 +69,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
71
69
|
'2-1.3.4.5'
|
72
70
|
}
|
73
71
|
|
74
|
-
it {
|
72
|
+
it { is_expected.to include invalid_error }
|
75
73
|
end
|
76
74
|
end
|
77
75
|
|
@@ -81,7 +79,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
81
79
|
'2.2.2.2-1.1.1.1'
|
82
80
|
}
|
83
81
|
|
84
|
-
it {
|
82
|
+
it { is_expected.to include invalid_error }
|
85
83
|
end
|
86
84
|
|
87
85
|
context 'without ordered range' do
|
@@ -89,7 +87,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
89
87
|
'1.1.1.1-2.2.2.2'
|
90
88
|
}
|
91
89
|
|
92
|
-
it {
|
90
|
+
it { is_expected.to be_empty }
|
93
91
|
end
|
94
92
|
end
|
95
93
|
|
@@ -107,8 +105,8 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
107
105
|
nil
|
108
106
|
}
|
109
107
|
|
110
|
-
it {
|
111
|
-
it {
|
108
|
+
it { is_expected.to include blank_error }
|
109
|
+
it { is_expected.not_to include invalid_error }
|
112
110
|
end
|
113
111
|
|
114
112
|
context 'with empty string' do
|
@@ -116,8 +114,8 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
116
114
|
''
|
117
115
|
}
|
118
116
|
|
119
|
-
it {
|
120
|
-
it {
|
117
|
+
it { is_expected.to include blank_error }
|
118
|
+
it { is_expected.not_to include invalid_error }
|
121
119
|
end
|
122
120
|
|
123
121
|
context 'without matching formatted value' do
|
@@ -125,7 +123,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
125
123
|
'non_matching_value'
|
126
124
|
}
|
127
125
|
|
128
|
-
it {
|
126
|
+
it { is_expected.to include invalid_error }
|
129
127
|
end
|
130
128
|
end
|
131
129
|
end
|
@@ -141,7 +139,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
141
139
|
'1.2.3.4/8'
|
142
140
|
}
|
143
141
|
|
144
|
-
it {
|
142
|
+
it { is_expected.to be_a MetasploitDataModels::IPAddress::V4::CIDR }
|
145
143
|
end
|
146
144
|
|
147
145
|
context 'with Nmap', pending: 'MSP-10712' do
|
@@ -149,7 +147,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
149
147
|
'1.2.3.4-5'
|
150
148
|
}
|
151
149
|
|
152
|
-
it {
|
150
|
+
it { is_expected.to be_a MetasploitDataModels::IPAddress::V4::Nmap }
|
153
151
|
end
|
154
152
|
|
155
153
|
context 'with Range' do
|
@@ -157,7 +155,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
157
155
|
'1.1.1.1-2.2.2.2'
|
158
156
|
}
|
159
157
|
|
160
|
-
it {
|
158
|
+
it { is_expected.to be_a MetasploitDataModels::IPAddress::V4::Range }
|
161
159
|
end
|
162
160
|
|
163
161
|
context 'with address' do
|
@@ -165,7 +163,7 @@ describe MetasploitDataModels::Search::Operation::IPAddress do
|
|
165
163
|
'1.2.3.4'
|
166
164
|
}
|
167
165
|
|
168
|
-
it {
|
166
|
+
it { is_expected.to be_a MetasploitDataModels::IPAddress::V4::Single }
|
169
167
|
end
|
170
168
|
end
|
171
169
|
|
@@ -1,13 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::Search::Operation::Port::Number do
|
1
|
+
RSpec.describe MetasploitDataModels::Search::Operation::Port::Number, type: :model do
|
4
2
|
context 'CONSTANTS' do
|
5
3
|
context 'BITS' do
|
6
4
|
subject(:bits) {
|
7
5
|
described_class::BITS
|
8
6
|
}
|
9
7
|
|
10
|
-
it {
|
8
|
+
it { is_expected.to eq(16) }
|
11
9
|
end
|
12
10
|
|
13
11
|
context 'MAXIMUM' do
|
@@ -15,7 +13,7 @@ describe MetasploitDataModels::Search::Operation::Port::Number do
|
|
15
13
|
described_class::MAXIMUM
|
16
14
|
}
|
17
15
|
|
18
|
-
it {
|
16
|
+
it { is_expected.to eq(65535) }
|
19
17
|
end
|
20
18
|
|
21
19
|
context 'MINIMUM' do
|
@@ -23,7 +21,7 @@ describe MetasploitDataModels::Search::Operation::Port::Number do
|
|
23
21
|
described_class::MINIMUM
|
24
22
|
}
|
25
23
|
|
26
|
-
it {
|
24
|
+
it { is_expected.to eq(0) }
|
27
25
|
end
|
28
26
|
|
29
27
|
context 'RANGE' do
|
@@ -31,11 +29,11 @@ describe MetasploitDataModels::Search::Operation::Port::Number do
|
|
31
29
|
described_class::RANGE
|
32
30
|
}
|
33
31
|
|
34
|
-
it {
|
32
|
+
it { is_expected.to eq((0..65535)) }
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
36
|
context 'validations' do
|
39
|
-
it {
|
37
|
+
it { is_expected.to ensure_inclusion_of(:value).in_range(described_class::RANGE) }
|
40
38
|
end
|
41
39
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::Search::Operation::Port::Range do
|
1
|
+
RSpec.describe MetasploitDataModels::Search::Operation::Port::Range, type: :model do
|
4
2
|
subject(:port_range_operation) {
|
5
3
|
described_class.new(
|
6
4
|
value: formatted_value
|
@@ -11,7 +9,7 @@ describe MetasploitDataModels::Search::Operation::Port::Range do
|
|
11
9
|
'1'
|
12
10
|
}
|
13
11
|
|
14
|
-
it {
|
12
|
+
it { is_expected.to be_a MetasploitDataModels::Search::Operation::Range }
|
15
13
|
|
16
14
|
context 'validations' do
|
17
15
|
before(:each) do
|
@@ -30,7 +28,7 @@ describe MetasploitDataModels::Search::Operation::Port::Range do
|
|
30
28
|
'1-2'
|
31
29
|
}
|
32
30
|
|
33
|
-
it {
|
31
|
+
it { is_expected.to be_empty }
|
34
32
|
end
|
35
33
|
|
36
34
|
# this can't actually happen because the minimum is 0 and a negative number can't be parsed, but validation
|
@@ -64,7 +62,7 @@ describe MetasploitDataModels::Search::Operation::Port::Range do
|
|
64
62
|
1
|
65
63
|
}
|
66
64
|
|
67
|
-
it {
|
65
|
+
it { is_expected.to include error }
|
68
66
|
end
|
69
67
|
|
70
68
|
context 'without Range#begin covered by MetasploitDataModels::Search::Operation::Port::Number::RANGE' do
|
@@ -86,7 +84,7 @@ describe MetasploitDataModels::Search::Operation::Port::Range do
|
|
86
84
|
MetasploitDataModels::Search::Operation::Port::Number::MAXIMUM + 1
|
87
85
|
}
|
88
86
|
|
89
|
-
it {
|
87
|
+
it { is_expected.to include error }
|
90
88
|
end
|
91
89
|
end
|
92
90
|
|
@@ -119,8 +117,8 @@ describe MetasploitDataModels::Search::Operation::Port::Range do
|
|
119
117
|
'b'
|
120
118
|
}
|
121
119
|
|
122
|
-
it {
|
123
|
-
it {
|
120
|
+
it { is_expected.to include begin_error }
|
121
|
+
it { is_expected.to include end_error }
|
124
122
|
end
|
125
123
|
end
|
126
124
|
|
@@ -133,7 +131,7 @@ describe MetasploitDataModels::Search::Operation::Port::Range do
|
|
133
131
|
'1'
|
134
132
|
}
|
135
133
|
|
136
|
-
it {
|
134
|
+
it { is_expected.to include(error) }
|
137
135
|
end
|
138
136
|
end
|
139
137
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::Search::Operation::Range do
|
1
|
+
RSpec.describe MetasploitDataModels::Search::Operation::Range, type: :model do
|
4
2
|
subject(:range_operation) {
|
5
3
|
described_class.new(attributes)
|
6
4
|
}
|
@@ -11,7 +9,7 @@ describe MetasploitDataModels::Search::Operation::Range do
|
|
11
9
|
described_class::SEPARATOR
|
12
10
|
}
|
13
11
|
|
14
|
-
it {
|
12
|
+
it { is_expected.to eq('-') }
|
15
13
|
end
|
16
14
|
end
|
17
15
|
|
@@ -57,7 +55,7 @@ describe MetasploitDataModels::Search::Operation::Range do
|
|
57
55
|
'1-2'
|
58
56
|
}
|
59
57
|
|
60
|
-
it {
|
58
|
+
it { is_expected.not_to include(error) }
|
61
59
|
end
|
62
60
|
|
63
61
|
context 'with begin same as end' do
|
@@ -72,7 +70,7 @@ describe MetasploitDataModels::Search::Operation::Range do
|
|
72
70
|
'1-1'
|
73
71
|
}
|
74
72
|
|
75
|
-
it {
|
73
|
+
it { is_expected.not_to include(error) }
|
76
74
|
end
|
77
75
|
|
78
76
|
context 'with begin after end' do
|
@@ -87,7 +85,7 @@ describe MetasploitDataModels::Search::Operation::Range do
|
|
87
85
|
'2-1'
|
88
86
|
}
|
89
87
|
|
90
|
-
it {
|
88
|
+
it { is_expected.to include error }
|
91
89
|
end
|
92
90
|
end
|
93
91
|
|
@@ -103,7 +101,7 @@ describe MetasploitDataModels::Search::Operation::Range do
|
|
103
101
|
'1..2'
|
104
102
|
}
|
105
103
|
|
106
|
-
it {
|
104
|
+
it { is_expected.not_to include(error) }
|
107
105
|
end
|
108
106
|
end
|
109
107
|
|
@@ -113,7 +111,7 @@ describe MetasploitDataModels::Search::Operation::Range do
|
|
113
111
|
'1-2'
|
114
112
|
}
|
115
113
|
|
116
|
-
it {
|
114
|
+
it { is_expected.to be_empty }
|
117
115
|
end
|
118
116
|
|
119
117
|
context 'without Range' do
|
@@ -125,7 +123,7 @@ describe MetasploitDataModels::Search::Operation::Range do
|
|
125
123
|
'1..2'
|
126
124
|
}
|
127
125
|
|
128
|
-
it {
|
126
|
+
it { is_expected.to include error }
|
129
127
|
end
|
130
128
|
end
|
131
129
|
end
|