metasploit-model 0.28.0-java → 0.29.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -1
  3. data/config/locales/en.yml +0 -171
  4. data/lib/metasploit/model.rb +0 -2
  5. data/lib/metasploit/model/spec.rb +0 -130
  6. data/lib/metasploit/model/version.rb +1 -1
  7. data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +4 -6
  8. data/spec/support/shared/examples/metasploit/model/translation.rb +1 -1
  9. data/spec/support/shared/examples/search_association.rb +1 -1
  10. data/spec/support/shared/examples/search_with.rb +4 -2
  11. metadata +2 -348
  12. data/app/models/metasploit/model/module/ancestor/spec/template.rb +0 -125
  13. data/app/models/metasploit/model/module/class/spec/template.rb +0 -92
  14. data/app/models/metasploit/model/module/instance/spec/template.rb +0 -97
  15. data/app/models/metasploit/model/spec/template.rb +0 -277
  16. data/app/validators/derivation_validator.rb +0 -17
  17. data/app/validators/dynamic_length_validator.rb +0 -45
  18. data/lib/metasploit/model/architecture.rb +0 -342
  19. data/lib/metasploit/model/author.rb +0 -54
  20. data/lib/metasploit/model/authority.rb +0 -141
  21. data/lib/metasploit/model/authority/bid.rb +0 -10
  22. data/lib/metasploit/model/authority/cve.rb +0 -10
  23. data/lib/metasploit/model/authority/msb.rb +0 -10
  24. data/lib/metasploit/model/authority/osvdb.rb +0 -10
  25. data/lib/metasploit/model/authority/pmasa.rb +0 -10
  26. data/lib/metasploit/model/authority/secunia.rb +0 -10
  27. data/lib/metasploit/model/authority/us_cert_vu.rb +0 -10
  28. data/lib/metasploit/model/authority/waraxe.rb +0 -31
  29. data/lib/metasploit/model/authority/zdi.rb +0 -10
  30. data/lib/metasploit/model/derivation.rb +0 -109
  31. data/lib/metasploit/model/derivation/full_name.rb +0 -19
  32. data/lib/metasploit/model/email_address.rb +0 -124
  33. data/lib/metasploit/model/module.rb +0 -20
  34. data/lib/metasploit/model/module/action.rb +0 -52
  35. data/lib/metasploit/model/module/ancestor.rb +0 -491
  36. data/lib/metasploit/model/module/ancestor/spec.rb +0 -6
  37. data/lib/metasploit/model/module/architecture.rb +0 -34
  38. data/lib/metasploit/model/module/author.rb +0 -40
  39. data/lib/metasploit/model/module/class.rb +0 -403
  40. data/lib/metasploit/model/module/class/spec.rb +0 -6
  41. data/lib/metasploit/model/module/handler.rb +0 -29
  42. data/lib/metasploit/model/module/instance.rb +0 -622
  43. data/lib/metasploit/model/module/instance/spec.rb +0 -6
  44. data/lib/metasploit/model/module/path.rb +0 -159
  45. data/lib/metasploit/model/module/platform.rb +0 -32
  46. data/lib/metasploit/model/module/rank.rb +0 -85
  47. data/lib/metasploit/model/module/reference.rb +0 -32
  48. data/lib/metasploit/model/module/stance.rb +0 -16
  49. data/lib/metasploit/model/module/target.rb +0 -78
  50. data/lib/metasploit/model/module/target/architecture.rb +0 -34
  51. data/lib/metasploit/model/module/target/platform.rb +0 -34
  52. data/lib/metasploit/model/module/type.rb +0 -38
  53. data/lib/metasploit/model/platform.rb +0 -246
  54. data/lib/metasploit/model/real_pathname.rb +0 -16
  55. data/lib/metasploit/model/reference.rb +0 -104
  56. data/spec/app/models/metasploit/model/module/ancestor/spec/template_spec.rb +0 -174
  57. data/spec/app/models/metasploit/model/module/class/spec/template_spec.rb +0 -222
  58. data/spec/app/models/metasploit/model/module/instance/spec/template_spec.rb +0 -201
  59. data/spec/app/models/metasploit/model/search/operator/deprecated/app_spec.rb +0 -62
  60. data/spec/app/models/metasploit/model/search/operator/deprecated/author_spec.rb +0 -197
  61. data/spec/app/models/metasploit/model/search/operator/deprecated/authority_spec.rb +0 -135
  62. data/spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb +0 -124
  63. data/spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb +0 -387
  64. data/spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb +0 -399
  65. data/spec/app/models/metasploit/model/spec/template_spec.rb +0 -23
  66. data/spec/app/validators/derivation_validator_spec.rb +0 -92
  67. data/spec/app/validators/dynamic_length_validator_spec.rb +0 -293
  68. data/spec/dummy/app/models/dummy/architecture.rb +0 -92
  69. data/spec/dummy/app/models/dummy/author.rb +0 -15
  70. data/spec/dummy/app/models/dummy/authority.rb +0 -130
  71. data/spec/dummy/app/models/dummy/email_address.rb +0 -27
  72. data/spec/dummy/app/models/dummy/module/action.rb +0 -25
  73. data/spec/dummy/app/models/dummy/module/ancestor.rb +0 -67
  74. data/spec/dummy/app/models/dummy/module/architecture.rb +0 -19
  75. data/spec/dummy/app/models/dummy/module/author.rb +0 -28
  76. data/spec/dummy/app/models/dummy/module/class.rb +0 -69
  77. data/spec/dummy/app/models/dummy/module/instance.rb +0 -209
  78. data/spec/dummy/app/models/dummy/module/path.rb +0 -64
  79. data/spec/dummy/app/models/dummy/module/platform.rb +0 -19
  80. data/spec/dummy/app/models/dummy/module/rank.rb +0 -44
  81. data/spec/dummy/app/models/dummy/module/reference.rb +0 -19
  82. data/spec/dummy/app/models/dummy/module/target.rb +0 -62
  83. data/spec/dummy/app/models/dummy/module/target/architecture.rb +0 -19
  84. data/spec/dummy/app/models/dummy/module/target/platform.rb +0 -19
  85. data/spec/dummy/app/models/dummy/platform.rb +0 -58
  86. data/spec/dummy/app/models/dummy/reference.rb +0 -31
  87. data/spec/dummy/spec/factories/dummy/architectures.rb +0 -13
  88. data/spec/dummy/spec/factories/dummy/authorities.rb +0 -32
  89. data/spec/dummy/spec/factories/dummy/authors.rb +0 -8
  90. data/spec/dummy/spec/factories/dummy/email_addresses.rb +0 -8
  91. data/spec/dummy/spec/factories/dummy/module/actions.rb +0 -13
  92. data/spec/dummy/spec/factories/dummy/module/ancestors.rb +0 -45
  93. data/spec/dummy/spec/factories/dummy/module/architectures.rb +0 -35
  94. data/spec/dummy/spec/factories/dummy/module/authors.rb +0 -10
  95. data/spec/dummy/spec/factories/dummy/module/classes.rb +0 -40
  96. data/spec/dummy/spec/factories/dummy/module/instances.rb +0 -86
  97. data/spec/dummy/spec/factories/dummy/module/paths.rb +0 -16
  98. data/spec/dummy/spec/factories/dummy/module/platforms.rb +0 -35
  99. data/spec/dummy/spec/factories/dummy/module/ranks.rb +0 -14
  100. data/spec/dummy/spec/factories/dummy/module/references.rb +0 -17
  101. data/spec/dummy/spec/factories/dummy/module/target/architectures.rb +0 -40
  102. data/spec/dummy/spec/factories/dummy/module/target/platforms.rb +0 -41
  103. data/spec/dummy/spec/factories/dummy/module/targets.rb +0 -46
  104. data/spec/dummy/spec/factories/dummy/platforms.rb +0 -3
  105. data/spec/dummy/spec/factories/dummy/references.rb +0 -26
  106. data/spec/factories/metasploit/model/architectures.rb +0 -6
  107. data/spec/factories/metasploit/model/authorities.rb +0 -28
  108. data/spec/factories/metasploit/model/authors.rb +0 -9
  109. data/spec/factories/metasploit/model/email_addresses.rb +0 -14
  110. data/spec/factories/metasploit/model/module/actions.rb +0 -9
  111. data/spec/factories/metasploit/model/module/ancestors.rb +0 -180
  112. data/spec/factories/metasploit/model/module/architectures.rb +0 -15
  113. data/spec/factories/metasploit/model/module/classes.rb +0 -47
  114. data/spec/factories/metasploit/model/module/handlers.rb +0 -3
  115. data/spec/factories/metasploit/model/module/instances.rb +0 -83
  116. data/spec/factories/metasploit/model/module/paths.rb +0 -51
  117. data/spec/factories/metasploit/model/module/platforms.rb +0 -15
  118. data/spec/factories/metasploit/model/module/ranks.rb +0 -9
  119. data/spec/factories/metasploit/model/module/references.rb +0 -11
  120. data/spec/factories/metasploit/model/module/stances.rb +0 -3
  121. data/spec/factories/metasploit/model/module/targets.rb +0 -22
  122. data/spec/factories/metasploit/model/module/types.rb +0 -5
  123. data/spec/factories/metasploit/model/references.rb +0 -88
  124. data/spec/lib/metasploit/model/architecture_spec.rb +0 -52
  125. data/spec/lib/metasploit/model/author_spec.rb +0 -6
  126. data/spec/lib/metasploit/model/authority/bid_spec.rb +0 -17
  127. data/spec/lib/metasploit/model/authority/cve_spec.rb +0 -17
  128. data/spec/lib/metasploit/model/authority/msb_spec.rb +0 -17
  129. data/spec/lib/metasploit/model/authority/osvdb_spec.rb +0 -17
  130. data/spec/lib/metasploit/model/authority/pmasa_spec.rb +0 -17
  131. data/spec/lib/metasploit/model/authority/secunia_spec.rb +0 -17
  132. data/spec/lib/metasploit/model/authority/us_cert_vu_spec.rb +0 -17
  133. data/spec/lib/metasploit/model/authority/waraxe_spec.rb +0 -51
  134. data/spec/lib/metasploit/model/authority/zdi_spec.rb +0 -21
  135. data/spec/lib/metasploit/model/authority_spec.rb +0 -10
  136. data/spec/lib/metasploit/model/derivation/full_name_spec.rb +0 -75
  137. data/spec/lib/metasploit/model/derivation_spec.rb +0 -217
  138. data/spec/lib/metasploit/model/email_address_spec.rb +0 -19
  139. data/spec/lib/metasploit/model/module/action_spec.rb +0 -6
  140. data/spec/lib/metasploit/model/module/ancestor_spec.rb +0 -6
  141. data/spec/lib/metasploit/model/module/architecture_spec.rb +0 -9
  142. data/spec/lib/metasploit/model/module/author_spec.rb +0 -6
  143. data/spec/lib/metasploit/model/module/class_spec.rb +0 -19
  144. data/spec/lib/metasploit/model/module/handler_spec.rb +0 -61
  145. data/spec/lib/metasploit/model/module/instance_spec.rb +0 -183
  146. data/spec/lib/metasploit/model/module/path_spec.rb +0 -6
  147. data/spec/lib/metasploit/model/module/platform_spec.rb +0 -9
  148. data/spec/lib/metasploit/model/module/rank_spec.rb +0 -29
  149. data/spec/lib/metasploit/model/module/reference_spec.rb +0 -9
  150. data/spec/lib/metasploit/model/module/stance_spec.rb +0 -30
  151. data/spec/lib/metasploit/model/module/target/architecture_spec.rb +0 -9
  152. data/spec/lib/metasploit/model/module/target/platform_spec.rb +0 -9
  153. data/spec/lib/metasploit/model/module/target_spec.rb +0 -9
  154. data/spec/lib/metasploit/model/module/type_spec.rb +0 -125
  155. data/spec/lib/metasploit/model/platform_spec.rb +0 -100
  156. data/spec/lib/metasploit/model/reference_spec.rb +0 -21
  157. data/spec/support/shared/contexts/metasploit/model/module/ancestor/contents/metasploit_module.rb +0 -12
  158. data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents.rb +0 -10
  159. data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents/metasploit_module.rb +0 -15
  160. data/spec/support/shared/examples/derives.rb +0 -115
  161. data/spec/support/shared/examples/metasploit/model/architecture.rb +0 -425
  162. data/spec/support/shared/examples/metasploit/model/architecture/seed.rb +0 -25
  163. data/spec/support/shared/examples/metasploit/model/author.rb +0 -27
  164. data/spec/support/shared/examples/metasploit/model/authority.rb +0 -124
  165. data/spec/support/shared/examples/metasploit/model/authority/seed.rb +0 -49
  166. data/spec/support/shared/examples/metasploit/model/email_address.rb +0 -220
  167. data/spec/support/shared/examples/metasploit/model/module/action.rb +0 -26
  168. data/spec/support/shared/examples/metasploit/model/module/ancestor.rb +0 -2004
  169. data/spec/support/shared/examples/metasploit/model/module/ancestor/payload_factory.rb +0 -63
  170. data/spec/support/shared/examples/metasploit/model/module/architecture.rb +0 -36
  171. data/spec/support/shared/examples/metasploit/model/module/author.rb +0 -29
  172. data/spec/support/shared/examples/metasploit/model/module/class.rb +0 -1514
  173. data/spec/support/shared/examples/metasploit/model/module/handler.rb +0 -21
  174. data/spec/support/shared/examples/metasploit/model/module/instance.rb +0 -1384
  175. data/spec/support/shared/examples/metasploit/model/module/instance/class_methods.rb +0 -537
  176. data/spec/support/shared/examples/metasploit/model/module/instance/is_not_stanced_with_module_type.rb +0 -22
  177. data/spec/support/shared/examples/metasploit/model/module/instance/is_stanced_with_module_type.rb +0 -38
  178. data/spec/support/shared/examples/metasploit/model/module/instance/validates/dynamic_length_of.rb +0 -131
  179. data/spec/support/shared/examples/metasploit/model/module/path.rb +0 -493
  180. data/spec/support/shared/examples/metasploit/model/module/platform.rb +0 -36
  181. data/spec/support/shared/examples/metasploit/model/module/rank.rb +0 -92
  182. data/spec/support/shared/examples/metasploit/model/module/reference.rb +0 -16
  183. data/spec/support/shared/examples/metasploit/model/module/target.rb +0 -29
  184. data/spec/support/shared/examples/metasploit/model/module/target/architecture.rb +0 -56
  185. data/spec/support/shared/examples/metasploit/model/module/target/platform.rb +0 -56
  186. data/spec/support/shared/examples/metasploit/model/platform.rb +0 -213
  187. data/spec/support/shared/examples/metasploit/model/real_pathname.rb +0 -29
  188. data/spec/support/shared/examples/metasploit/model/reference.rb +0 -410
  189. data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/app.rb +0 -44
  190. data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb +0 -72
  191. data/spec/support/templates/metasploit/model/module/ancestors/_attributes.rb.erb +0 -9
  192. data/spec/support/templates/metasploit/model/module/ancestors/_methods.rb.erb +0 -8
  193. data/spec/support/templates/metasploit/model/module/ancestors/_validations.rb.erb +0 -6
  194. data/spec/support/templates/metasploit/model/module/ancestors/base.rb.erb +0 -3
  195. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_auxiliary.rb.erb +0 -1
  196. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_encoder.rb.erb +0 -1
  197. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_exploit.rb.erb +0 -1
  198. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_non_payload.rb.erb +0 -5
  199. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_nop.rb.erb +0 -1
  200. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_payload.rb.erb +0 -4
  201. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_post.rb.erb +0 -1
  202. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_handled.rb.erb +0 -20
  203. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_single.rb.erb +0 -1
  204. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stage.rb.erb +0 -0
  205. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stager.rb.erb +0 -1
  206. data/spec/support/templates/metasploit/model/module/classes/_methods.rb.erb +0 -9
@@ -1,387 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Search::Operator::Deprecated::Ref do
4
- subject(:operator) do
5
- described_class.new(
6
- :klass => klass
7
- )
8
- end
9
-
10
- let(:klass) do
11
- Class.new
12
- end
13
-
14
- context '#children' do
15
- include_context 'Metasploit::Model::Search::Operator::Group::Union#children'
16
-
17
- let(:abbreviation_operator) do
18
- Metasploit::Model::Search::Operator::Attribute.new(
19
- :attribute => :abbreviation,
20
- :klass => authority_class,
21
- :type => :string
22
- )
23
- end
24
-
25
- let(:authority_class) do
26
- Class.new
27
- end
28
-
29
- let(:authorities_abbreviation_operator) do
30
- Metasploit::Model::Search::Operator::Association.new(
31
- :association => :authorities,
32
- :klass => klass,
33
- :source_operator => abbreviation_operator
34
- )
35
- end
36
-
37
- let(:designation_operator) do
38
- Metasploit::Model::Search::Operator::Attribute.new(
39
- :attribute => :designation,
40
- :klass => reference_class,
41
- :type => :string
42
- )
43
- end
44
-
45
- let(:reference_class) do
46
- Class.new
47
- end
48
-
49
- let(:references_designation_operator) do
50
- Metasploit::Model::Search::Operator::Association.new(
51
- :association => :references,
52
- :klass => klass,
53
- :source_operator => designation_operator
54
- )
55
- end
56
-
57
- let(:references_url_operator) do
58
- Metasploit::Model::Search::Operator::Association.new(
59
- :association => :references,
60
- :klass => klass,
61
- :source_operator => url_operator
62
- )
63
- end
64
-
65
- let(:url_operator) do
66
- Metasploit::Model::Search::Operator::Attribute.new(
67
- :attribute => :url,
68
- :klass => reference_class,
69
- :type => :string
70
- )
71
- end
72
-
73
- before(:each) do
74
- operator.stub(:operator).with('authorities.abbreviation').and_return(authorities_abbreviation_operator)
75
- operator.stub(:operator).with('references.designation').and_return(references_designation_operator)
76
- operator.stub(:operator).with('references.url').and_return(references_url_operator)
77
- end
78
-
79
- context "with '-'" do
80
- let(:formatted_value) do
81
- "#{head}-#{tail}"
82
- end
83
-
84
- context "with 'URL'" do
85
- let(:head) do
86
- 'URL'
87
- end
88
-
89
- context 'with blank url' do
90
- let(:tail) do
91
- ''
92
- end
93
-
94
- it { should be_empty }
95
- end
96
-
97
- context 'without blank url' do
98
- let(:tail) do
99
- FactoryGirl.generate :metasploit_model_reference_url
100
- end
101
-
102
- context 'authorities.abbreviation' do
103
- subject(:operation) do
104
- child('authorities.abbreviation')
105
- end
106
-
107
- it 'should not be in children' do
108
- operation.should be_nil
109
- end
110
- end
111
-
112
- context 'references.designation' do
113
- subject(:operation) do
114
- child('references.designation')
115
- end
116
-
117
- it 'should not be in children' do
118
- operation.should be_nil
119
- end
120
- end
121
-
122
- context 'references.url' do
123
- subject(:operation) do
124
- child('references.url')
125
- end
126
-
127
- context 'Metasploit::Model::Search::Operation::Association' do
128
- subject(:source_operation) {
129
- operation.source_operation
130
- }
131
-
132
- it "uses portion of formatted value after 'URL-' for value" do
133
- expect(source_operation.value).to eq(tail)
134
- end
135
- end
136
- end
137
- end
138
- end
139
-
140
- context "without 'URL'" do
141
- let(:head) do
142
- FactoryGirl.generate :metasploit_model_authority_abbreviation
143
- end
144
-
145
- let(:tail) do
146
- FactoryGirl.generate :metasploit_model_reference_designation
147
- end
148
-
149
- context 'with blank head' do
150
- let(:head) do
151
- ''
152
- end
153
-
154
- context 'authorities.abbreviation' do
155
- subject(:operation) do
156
- child('authorities.abbreviation')
157
- end
158
-
159
- it 'should not be in children' do
160
- operation.should be_nil
161
- end
162
- end
163
-
164
- context 'references.designation' do
165
- subject(:operation) do
166
- child('references.designation')
167
- end
168
-
169
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
170
- subject(:source_operation) {
171
- operation.source_operation
172
- }
173
-
174
- it "uses portion of formatted value after '-' for value" do
175
- expect(source_operation.value).to eq(tail)
176
- end
177
- end
178
- end
179
-
180
- context 'references.url' do
181
- subject(:operation) do
182
- child('references.url')
183
- end
184
-
185
- it 'should not be in children' do
186
- operation.should be_nil
187
- end
188
- end
189
- end
190
-
191
- context 'without blank head' do
192
- context 'authorities.abbreviation' do
193
- subject(:operation) do
194
- child('authorities.abbreviation')
195
- end
196
-
197
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
198
- subject(:source_operation) {
199
- operation.source_operation
200
- }
201
-
202
- it "uses portion of formatted value before '-' as value" do
203
- expect(source_operation.value).to eq(head)
204
- end
205
- end
206
- end
207
-
208
- context 'references.designation' do
209
- subject(:operation) do
210
- child('references.designation')
211
- end
212
-
213
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
214
- subject(:source_operation) {
215
- operation.source_operation
216
- }
217
-
218
- it "uses portion of formatted value after '-' as value" do
219
- expect(source_operation.value).to eq(tail)
220
- end
221
- end
222
- end
223
-
224
- context 'references.url' do
225
- subject(:operation) do
226
- child('references.url')
227
- end
228
-
229
- it 'should not be in children' do
230
- operation.should be_nil
231
- end
232
- end
233
- end
234
-
235
- context 'with blank tail' do
236
- let(:tail) do
237
- ''
238
- end
239
-
240
- context 'authorities.abbreviation' do
241
- subject(:operation) do
242
- child('authorities.abbreviation')
243
- end
244
-
245
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
246
- subject(:source_operation) {
247
- operation.source_operation
248
- }
249
-
250
- it "use portion of formatted value before '-' for value" do
251
- expect(source_operation.value).to eq(head)
252
- end
253
- end
254
- end
255
-
256
- context 'references.designation' do
257
- subject(:operation) do
258
- child('references.designation')
259
- end
260
-
261
- it 'should not be in children' do
262
- operation.should be_nil
263
- end
264
- end
265
-
266
- context 'references.url' do
267
- subject(:operation) do
268
- child('references.url')
269
- end
270
-
271
- it 'should not be in children' do
272
- operation.should be_nil
273
- end
274
- end
275
- end
276
-
277
- context 'without blank tail' do
278
- context 'authorities.abbreviation' do
279
- subject(:operation) do
280
- child('authorities.abbreviation')
281
- end
282
-
283
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
284
- subject(:source_operation) {
285
- operation.source_operation
286
- }
287
-
288
- it "uses portion of format value before '-' for value" do
289
- expect(source_operation.value).to eq(head)
290
- end
291
- end
292
- end
293
-
294
- context 'references.designation' do
295
- subject(:operation) do
296
- child('references.designation')
297
- end
298
-
299
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
300
- subject(:source_operation) {
301
- operation.source_operation
302
- }
303
-
304
- it "uses portion of format value after '-' for value" do
305
- expect(source_operation.value).to eq(tail)
306
- end
307
- end
308
- end
309
-
310
- context 'references.url' do
311
- subject(:operation) do
312
- child('references.url')
313
- end
314
-
315
- it 'should not be in children' do
316
- operation.should be_nil
317
- end
318
- end
319
- end
320
- end
321
- end
322
-
323
- context "without '-'" do
324
- context 'with blank' do
325
- let(:formatted_value) do
326
- ''
327
- end
328
-
329
- it { should be_empty }
330
- end
331
-
332
- context 'without blank' do
333
- let(:formatted_value) do
334
- 'ref_value'
335
- end
336
-
337
- context 'authorities.abbreviation' do
338
- subject(:operation) do
339
- child('authorities.abbreviation')
340
- end
341
-
342
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
343
- subject(:source_operation) {
344
- operation.source_operation
345
- }
346
-
347
- it 'uses formatted value for value' do
348
- expect(source_operation.value).to eq(formatted_value)
349
- end
350
- end
351
- end
352
-
353
- context 'references.designation' do
354
- subject(:operation) do
355
- child('references.designation')
356
- end
357
-
358
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
359
- subject(:source_operation) {
360
- operation.source_operation
361
- }
362
-
363
- it 'uses formatted value for value' do
364
- expect(source_operation.value).to eq(formatted_value)
365
- end
366
- end
367
- end
368
-
369
- context 'references.url' do
370
- subject(:operation) do
371
- child('references.url')
372
- end
373
-
374
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
375
- subject(:source_operation) {
376
- operation.source_operation
377
- }
378
-
379
- it 'uses formatted value for value' do
380
- expect(source_operation.value).to eq(formatted_value)
381
- end
382
- end
383
- end
384
- end
385
- end
386
- end
387
- end
@@ -1,399 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Search::Operator::Deprecated::Text do
4
- subject(:operator) do
5
- described_class.new(
6
- :klass => klass
7
- )
8
- end
9
-
10
- let(:klass) do
11
- Class.new
12
- end
13
-
14
- context 'CONSTANTS' do
15
- context 'OPERATOR_NAMES' do
16
- subject(:operator_names) do
17
- described_class::OPERATOR_NAMES
18
- end
19
-
20
- it { should include 'description' }
21
- it { should include 'name' }
22
- it { should include 'actions.name' }
23
-
24
- it 'should include platform instead of platforms.fully_qualified_name and targets.name' do
25
- operator_names.should include('platform')
26
- operator_names.should_not include('platforms.fully_qualified_name')
27
- operator_names.should_not include('targets.name')
28
- end
29
-
30
- it 'should include ref instead of authors.name, references.designation and references.url to handle deprecated reference syntax' do
31
- operator_names.should include('ref')
32
- operator_names.should_not include('authors.name')
33
- operator_names.should_not include('references.designation')
34
- operator_names.should_not include('references.url')
35
- end
36
- end
37
- end
38
-
39
- context '#children' do
40
- include_context 'Metasploit::Model::Search::Operator::Group::Union#children'
41
-
42
- let(:action_name_operator) do
43
- Metasploit::Model::Search::Operator::Attribute.new(
44
- :attribute => :name,
45
- :klass => action_class,
46
- :type => :string
47
- )
48
- end
49
-
50
- let(:action_class) do
51
- Class.new
52
- end
53
-
54
- let(:actions_name_operator) do
55
- Metasploit::Model::Search::Operator::Association.new(
56
- :association => :actions,
57
- :source_operator => action_name_operator,
58
- :klass => klass
59
- )
60
- end
61
-
62
- let(:architecture_class) do
63
- Class.new
64
- end
65
-
66
- let(:architecture_abbreviation_operator) do
67
- Metasploit::Model::Search::Operator::Attribute.new(
68
- :attribute => :abbreviation,
69
- :klass => architecture_class,
70
- :type => :string
71
- )
72
- end
73
-
74
- let(:architectures_abbreviation_operator) do
75
- Metasploit::Model::Search::Operator::Association.new(
76
- :association => :architectures,
77
- :source_operator => architecture_abbreviation_operator,
78
- :klass => klass
79
- )
80
- end
81
-
82
- let(:authority_class) do
83
- Class.new
84
- end
85
-
86
- let(:authority_abbreviation_operator) do
87
- Metasploit::Model::Search::Operator::Attribute.new(
88
- :attribute => :abbreviation,
89
- :klass => authority_class,
90
- :type => :string
91
- )
92
- end
93
-
94
- let(:authorities_abbreviation_operator) do
95
- Metasploit::Model::Search::Operator::Association.new(
96
- :association => :authorities,
97
- :source_operator => authority_abbreviation_operator,
98
- :klass => klass
99
- )
100
- end
101
-
102
- let(:description_operator) do
103
- Metasploit::Model::Search::Operator::Attribute.new(
104
- :attribute => :description,
105
- :klass => klass,
106
- :type => :string
107
- )
108
- end
109
-
110
- let(:formatted_value) do
111
- 'value'
112
- end
113
-
114
- let(:name_operator) do
115
- Metasploit::Model::Search::Operator::Attribute.new(
116
- :attribute => :name,
117
- :klass => klass,
118
- :type => :string
119
- )
120
- end
121
-
122
- let(:platform_class) do
123
- Class.new
124
- end
125
-
126
- let(:platform_operator) do
127
- Metasploit::Model::Search::Operator::Deprecated::Platform.new(
128
- :klass => klass,
129
- :name => :platform
130
- )
131
- end
132
-
133
- let(:platform_fully_qualified_name_operator) do
134
- Metasploit::Model::Search::Operator::Attribute.new(
135
- :attribute => :fully_qualified_name,
136
- :klass => platform_class,
137
- :type => :string
138
- )
139
- end
140
-
141
- let(:platforms_fully_qualified_name_operator) do
142
- Metasploit::Model::Search::Operator::Association.new(
143
- :association => :platforms,
144
- :source_operator => platform_fully_qualified_name_operator,
145
- :klass => klass
146
- )
147
- end
148
-
149
- let(:ref_operator) do
150
- Metasploit::Model::Search::Operator::Deprecated::Ref.new(
151
- :klass => klass
152
- )
153
- end
154
-
155
- let(:reference_class) do
156
- Class.new
157
- end
158
-
159
- let(:reference_designation_operator) do
160
- Metasploit::Model::Search::Operator::Attribute.new(
161
- :attribute => :designation,
162
- :klass => reference_class,
163
- :type => :string
164
- )
165
- end
166
-
167
- let(:references_designation_operator) do
168
- Metasploit::Model::Search::Operator::Association.new(
169
- :association => :references,
170
- :source_operator => reference_designation_operator,
171
- :klass => klass
172
- )
173
- end
174
-
175
- let(:reference_url_operator) do
176
- Metasploit::Model::Search::Operator::Attribute.new(
177
- :attribute => :url,
178
- :klass => reference_class,
179
- :type => :string
180
- )
181
- end
182
-
183
- let(:references_url_operator) do
184
- Metasploit::Model::Search::Operator::Association.new(
185
- :association => :references,
186
- :source_operator => reference_url_operator,
187
- :klass => klass
188
- )
189
- end
190
-
191
- let(:target_class) do
192
- Class.new
193
- end
194
-
195
- let(:target_name_operator) do
196
- Metasploit::Model::Search::Operator::Attribute.new(
197
- :attribute => :name,
198
- :klass => target_class,
199
- :type => :string
200
- )
201
- end
202
-
203
- let(:targets_name_operator) do
204
- Metasploit::Model::Search::Operator::Association.new(
205
- :association => :targets,
206
- :source_operator => target_name_operator,
207
- :klass => klass
208
- )
209
- end
210
-
211
- before(:each) do
212
- operator.stub(:operator).with('description').and_return(description_operator)
213
- operator.stub(:operator).with('name').and_return(name_operator)
214
- operator.stub(:operator).with('actions.name').and_return(actions_name_operator)
215
- operator.stub(:operator).with('architectures.abbreviation').and_return(architectures_abbreviation_operator)
216
- operator.stub(:operator).with('platform').and_return(platform_operator)
217
- operator.stub(:operator).with('ref').and_return(ref_operator)
218
-
219
- platform_operator.stub(:operator).with(
220
- 'platforms.fully_qualified_name'
221
- ).and_return(
222
- platforms_fully_qualified_name_operator
223
- )
224
- platform_operator.stub(:operator).with('targets.name').and_return(targets_name_operator)
225
-
226
- ref_operator.stub(:operator).with('authorities.abbreviation').and_return(authorities_abbreviation_operator)
227
- ref_operator.stub(:operator).with('references.designation').and_return(references_designation_operator)
228
- ref_operator.stub(:operator).with('references.url').and_return(references_url_operator)
229
- end
230
-
231
- context 'description' do
232
- subject(:operation) do
233
- child('description')
234
- end
235
-
236
- it 'should use formatted value for value' do
237
- operation.value.should == formatted_value
238
- end
239
- end
240
-
241
- context 'name' do
242
- subject(:operation) do
243
- child('name')
244
- end
245
-
246
- it 'should use formatted value for value' do
247
- operation.value.should == formatted_value
248
- end
249
- end
250
-
251
- context 'actions.name' do
252
- subject(:operation) do
253
- child('actions.name')
254
- end
255
-
256
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
257
- subject(:source_operation) {
258
- operation.source_operation
259
- }
260
-
261
- it 'should use formatted value for value' do
262
- expect(source_operation.value).to eq(formatted_value)
263
- end
264
- end
265
- end
266
-
267
- context 'architectures.abbreviation' do
268
- subject(:operation) do
269
- child('architectures.abbreviation')
270
- end
271
-
272
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
273
- subject(:source_operation) {
274
- operation.source_operation
275
- }
276
-
277
- it 'should use formatted value for value' do
278
- expect(source_operation.value).to eq(formatted_value)
279
- end
280
- end
281
- end
282
-
283
- context 'platform' do
284
- subject(:child_operation) do
285
- child('platform')
286
- end
287
-
288
- context 'children' do
289
- subject(:grandchildren) do
290
- child_operation.children
291
- end
292
-
293
- def grandchild(formatted_operator)
294
- grandchildren.find { |operation|
295
- operation.operator.name == formatted_operator.to_sym
296
- }
297
- end
298
-
299
- context 'platforms.fully_qualified_name' do
300
- subject(:grandchild_operation) do
301
- grandchild('platforms.fully_qualified_name')
302
- end
303
-
304
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
305
- subject(:source_operation) {
306
- grandchild_operation.source_operation
307
- }
308
-
309
- it 'should use formatted value for value' do
310
- expect(source_operation.value).to eq(formatted_value)
311
- end
312
- end
313
- end
314
-
315
- context 'targets.name' do
316
- subject(:grandchild_operation) do
317
- grandchild('targets.name')
318
- end
319
-
320
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
321
- subject(:source_operation) {
322
- grandchild_operation.source_operation
323
- }
324
-
325
- it 'should use formatted value for value' do
326
- expect(source_operation.value).to eq(formatted_value)
327
- end
328
- end
329
- end
330
- end
331
- end
332
-
333
- context 'ref' do
334
- subject(:child_operation) do
335
- child('ref')
336
- end
337
-
338
- context 'children' do
339
- subject(:grandchildren) do
340
- child_operation.children
341
- end
342
-
343
- def grandchild(formatted_operator)
344
- grandchildren.find { |operation|
345
- operation.operator.name == formatted_operator.to_sym
346
- }
347
- end
348
-
349
- context 'authorities.abbreviation' do
350
- subject(:grandchild_operation) do
351
- grandchild('authorities.abbreviation')
352
- end
353
-
354
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
355
- subject(:source_operation) {
356
- grandchild_operation.source_operation
357
- }
358
-
359
- it 'should use formatted value for value' do
360
- expect(source_operation.value).to eq(formatted_value)
361
- end
362
- end
363
- end
364
-
365
- context 'references.designation' do
366
- subject(:grandchild_operation) do
367
- grandchild('references.designation')
368
- end
369
-
370
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
371
- subject(:source_operation) {
372
- grandchild_operation.source_operation
373
- }
374
-
375
- it 'should use formatted value for value' do
376
- expect(source_operation.value).to eq(formatted_value)
377
- end
378
- end
379
- end
380
-
381
- context 'references.url' do
382
- subject(:grandchild_operation) do
383
- grandchild('references.url')
384
- end
385
-
386
- context 'Metasploit::Model::Search::Operation::Association#source_operation' do
387
- subject(:source_operation) {
388
- grandchild_operation.source_operation
389
- }
390
-
391
- it 'should use formatted value for value' do
392
- expect(source_operation.value).to eq(formatted_value)
393
- end
394
- end
395
- end
396
- end
397
- end
398
- end
399
- end