metasploit_data_models 1.0.0.pre.rails.pre.4.0b → 1.0.0

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