metasploit-model 0.30.2 → 1.0.0.pre.rails.pre.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +4 -2
  3. data/CONTRIBUTING.md +49 -9
  4. data/Gemfile +8 -3
  5. data/lib/metasploit/model.rb +5 -0
  6. data/lib/metasploit/model/engine.rb +1 -1
  7. data/lib/metasploit/model/version.rb +14 -26
  8. data/metasploit-model.gemspec +5 -3
  9. data/spec/app/models/metasploit/model/association/reflection_spec.rb +7 -5
  10. data/spec/app/models/metasploit/model/search/group/base_spec.rb +4 -2
  11. data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +4 -2
  12. data/spec/app/models/metasploit/model/search/group/union_spec.rb +4 -2
  13. data/spec/app/models/metasploit/model/search/operation/association_spec.rb +9 -7
  14. data/spec/app/models/metasploit/model/search/operation/base_spec.rb +7 -5
  15. data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +11 -14
  16. data/spec/app/models/metasploit/model/search/operation/date_spec.rb +8 -6
  17. data/spec/app/models/metasploit/model/search/operation/group/base_spec.rb +14 -12
  18. data/spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb +4 -2
  19. data/spec/app/models/metasploit/model/search/operation/group/union_spec.rb +4 -2
  20. data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +4 -2
  21. data/spec/app/models/metasploit/model/search/operation/null_spec.rb +6 -4
  22. data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +4 -2
  23. data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +4 -2
  24. data/spec/app/models/metasploit/model/search/operation/set_spec.rb +6 -4
  25. data/spec/app/models/metasploit/model/search/operation/string_spec.rb +4 -2
  26. data/spec/app/models/metasploit/model/search/operator/association_spec.rb +8 -6
  27. data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +14 -12
  28. data/spec/app/models/metasploit/model/search/operator/base_spec.rb +5 -3
  29. data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +11 -13
  30. data/spec/app/models/metasploit/model/search/operator/group/base_spec.rb +7 -5
  31. data/spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb +5 -3
  32. data/spec/app/models/metasploit/model/search/operator/group/union_spec.rb +5 -3
  33. data/spec/app/models/metasploit/model/search/operator/null_spec.rb +7 -5
  34. data/spec/app/models/metasploit/model/search/operator/single_spec.rb +28 -26
  35. data/spec/app/models/metasploit/model/search/query_spec.rb +50 -48
  36. data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +9 -7
  37. data/spec/app/validators/ip_format_validator_spec.rb +9 -7
  38. data/spec/app/validators/nil_validator_spec.rb +5 -3
  39. data/spec/app/validators/parameters_validator_spec.rb +29 -29
  40. data/spec/app/validators/password_is_strong_validator_spec.rb +19 -17
  41. data/spec/dummy/config/application.rb +3 -1
  42. data/spec/dummy/config/environments/development.rb +0 -3
  43. data/spec/lib/metasploit/model/association/error_spec.rb +3 -1
  44. data/spec/lib/metasploit/model/association_spec.rb +10 -8
  45. data/spec/lib/metasploit/model/base_spec.rb +5 -3
  46. data/spec/lib/metasploit/model/engine_spec.rb +11 -48
  47. data/spec/lib/metasploit/model/file_spec.rb +5 -3
  48. data/spec/lib/metasploit/model/invalid_spec.rb +9 -7
  49. data/spec/lib/metasploit/model/login/status_spec.rb +3 -1
  50. data/spec/lib/metasploit/model/nilify_blanks_spec.rb +13 -11
  51. data/spec/lib/metasploit/model/realm/key_spec.rb +17 -15
  52. data/spec/lib/metasploit/model/search/association/tree_spec.rb +5 -3
  53. data/spec/lib/metasploit/model/search/association_spec.rb +4 -2
  54. data/spec/lib/metasploit/model/search/attribute_spec.rb +8 -6
  55. data/spec/lib/metasploit/model/search/operation/value/integer_spec.rb +3 -1
  56. data/spec/lib/metasploit/model/search/operation/value/string_spec.rb +3 -1
  57. data/spec/lib/metasploit/model/search/operation_spec.rb +13 -11
  58. data/spec/lib/metasploit/model/search/operator/help_spec.rb +3 -1
  59. data/spec/lib/metasploit/model/search/with_spec.rb +9 -7
  60. data/spec/lib/metasploit/model/search_spec.rb +13 -11
  61. data/spec/lib/metasploit/model/spec/error_spec.rb +4 -2
  62. data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +7 -5
  63. data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +6 -4
  64. data/spec/lib/metasploit/model/spec_spec.rb +7 -9
  65. data/spec/lib/metasploit/model/translation_spec.rb +12 -10
  66. data/spec/lib/metasploit/model/version_spec.rb +139 -3
  67. data/spec/lib/metasploit/model/visitation/visit_spec.rb +26 -28
  68. data/spec/matchers/validate_nilness_of_spec.rb +2 -0
  69. data/spec/spec_helper.rb +10 -80
  70. data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +1 -1
  71. data/spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb +8 -8
  72. data/spec/support/shared/examples/metasploit/model/search/operation/value/string.rb +5 -5
  73. data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +16 -18
  74. data/spec/support/shared/examples/metasploit/model/translation.rb +4 -4
  75. data/spec/support/shared/examples/search/query.rb +3 -3
  76. data/spec/support/shared/examples/search_association.rb +2 -2
  77. data/spec/support/shared/examples/search_attribute.rb +3 -3
  78. data/spec/support/shared/examples/search_with.rb +3 -3
  79. metadata +20 -27
  80. data/CHANGELOG.md +0 -6
  81. data/RELEASING.md +0 -86
  82. data/UPGRADING.md +0 -1
  83. data/spec/lib/metasploit/model_spec.rb +0 -4
@@ -1,4 +1,6 @@
1
- RSpec.describe Metasploit::Model::Search::Operator::Group::Base, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operator::Group::Base do
2
4
  subject(:operator) do
3
5
  described_class.new
4
6
  end
@@ -48,10 +50,10 @@ RSpec.describe Metasploit::Model::Search::Operator::Group::Base, type: :model do
48
50
  #
49
51
 
50
52
  before(:each) do
51
- allow(operator).to receive(:children).and_return(children)
53
+ operator.stub(:children => children)
52
54
  end
53
55
 
54
- it { is_expected.to be_a Metasploit::Model::Search::Operation::Group::Base }
56
+ it { should be_a Metasploit::Model::Search::Operation::Group::Base }
55
57
 
56
58
  context 'children' do
57
59
  subject(:operation_children) do
@@ -73,7 +75,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Group::Base, type: :model do
73
75
  end
74
76
 
75
77
  it 'should be the operator itself' do
76
- expect(operation_operator).to eq(operator)
78
+ operation_operator.should == operator
77
79
  end
78
80
  end
79
81
 
@@ -83,7 +85,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Group::Base, type: :model do
83
85
  end
84
86
 
85
87
  it 'should be formatted value' do
86
- expect(value).to eq(formatted_value)
88
+ value.should == formatted_value
87
89
  end
88
90
  end
89
91
  end
@@ -1,11 +1,13 @@
1
- RSpec.describe Metasploit::Model::Search::Operator::Group::Intersection, type: :model do
2
- it { is_expected.to be_a Metasploit::Model::Search::Operator::Group::Base }
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operator::Group::Intersection do
4
+ it { should be_a Metasploit::Model::Search::Operator::Group::Base }
3
5
 
4
6
  context 'operation_class_name' do
5
7
  subject(:operation_class_name) {
6
8
  described_class.operation_class_name
7
9
  }
8
10
 
9
- it { is_expected.to eq('Metasploit::Model::Search::Operation::Group::Intersection') }
11
+ it { should == 'Metasploit::Model::Search::Operation::Group::Intersection' }
10
12
  end
11
13
  end
@@ -1,11 +1,13 @@
1
- RSpec.describe Metasploit::Model::Search::Operator::Group::Union, type: :model do
2
- it { is_expected.to be_a Metasploit::Model::Search::Operator::Group::Base }
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operator::Group::Union do
4
+ it { should be_a Metasploit::Model::Search::Operator::Group::Base }
3
5
 
4
6
  context 'operation_class_name' do
5
7
  subject(:operation_class_name) {
6
8
  described_class.operation_class_name
7
9
  }
8
10
 
9
- it { is_expected.to eq('Metasploit::Model::Search::Operation::Group::Union') }
11
+ it { should == 'Metasploit::Model::Search::Operation::Group::Union' }
10
12
  end
11
13
  end
@@ -1,9 +1,11 @@
1
- RSpec.describe Metasploit::Model::Search::Operator::Null, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operator::Null do
2
4
  subject(:operator) do
3
5
  described_class.new
4
6
  end
5
7
 
6
- it { is_expected.to be_a Metasploit::Model::Search::Operator::Single }
8
+ it { should be_a Metasploit::Model::Search::Operator::Single }
7
9
 
8
10
  context 'validations' do
9
11
  context 'name' do
@@ -16,7 +18,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Null, type: :model do
16
18
  end
17
19
 
18
20
  it 'should record error' do
19
- expect(operator.errors[:name]).to include(error)
21
+ operator.errors[:name].should include(error)
20
22
  end
21
23
  end
22
24
  end
@@ -26,7 +28,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Null, type: :model do
26
28
  operator.type
27
29
  end
28
30
 
29
- it { is_expected.to be_nil }
31
+ it { should be_nil }
30
32
  end
31
33
 
32
34
  context '#operation_class' do
@@ -34,6 +36,6 @@ RSpec.describe Metasploit::Model::Search::Operator::Null, type: :model do
34
36
  operator.send(:operation_class)
35
37
  end
36
38
 
37
- it { is_expected.to eq(Metasploit::Model::Search::Operation::Null) }
39
+ it { should == Metasploit::Model::Search::Operation::Null }
38
40
  end
39
41
  end
@@ -1,9 +1,11 @@
1
- RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Operator::Single do
2
4
  subject(:operator) do
3
5
  described_class.new
4
6
  end
5
7
 
6
- it { is_expected.to be_a Metasploit::Model::Search::Operator::Base }
8
+ it { should be_a Metasploit::Model::Search::Operator::Base }
7
9
 
8
10
  context 'CONSTANTS' do
9
11
  context 'MODULE_SEPARATOR' do
@@ -11,7 +13,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
11
13
  described_class::MODULE_SEPARATOR
12
14
  end
13
15
 
14
- it { is_expected.to eq('::') }
16
+ it { should == '::' }
15
17
  end
16
18
 
17
19
  context 'OPERATION_NAMESPACE_NAME' do
@@ -19,7 +21,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
19
21
  described_class::OPERATION_NAMESPACE_NAME
20
22
  end
21
23
 
22
- it { is_expected.to eq('Metasploit::Model::Search::Operation') }
24
+ it { should == 'Metasploit::Model::Search::Operation' }
23
25
  end
24
26
  end
25
27
 
@@ -65,7 +67,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
65
67
  end
66
68
 
67
69
  it 'should be the constant_name of the key and value separated by MODULE_SEPARATOR' do
68
- expect(constant_name).to eq("#{key_constant_name}#{described_class::MODULE_SEPARATOR}#{value_constant_name}")
70
+ constant_name.should == "#{key_constant_name}#{described_class::MODULE_SEPARATOR}#{value_constant_name}"
69
71
  end
70
72
  end
71
73
 
@@ -91,7 +93,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
91
93
  end
92
94
 
93
95
  it 'should constantize string version of Symbol' do
94
- expect(constant_name).to eq('Integer')
96
+ constant_name.should == 'Integer'
95
97
  end
96
98
  end
97
99
 
@@ -122,20 +124,20 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
122
124
  end
123
125
 
124
126
  before(:each) do
125
- allow(operator).to receive(:operation_class).and_return(operation_class)
127
+ operator.stub(:operation_class => operation_class)
126
128
  end
127
129
 
128
130
  it 'should call new on #operation_class' do
129
- expect(operation_class).to receive(:new).with(:value => formatted_value, :operator => operator)
131
+ operation_class.should_receive(:new).with(:value => formatted_value, :operator => operator)
130
132
 
131
133
  operate_on
132
134
  end
133
135
 
134
136
  it 'should return instance of #operation_class' do
135
137
  operation = double('Operation')
136
- allow(operation_class).to receive(:new).and_return(operation)
138
+ operation_class.stub(:new => operation)
137
139
 
138
- expect(operate_on).to eq(operation)
140
+ operate_on.should == operation
139
141
  end
140
142
  end
141
143
 
@@ -145,7 +147,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
145
147
  end
146
148
 
147
149
  before(:each) do
148
- allow(operator).to receive(:type).and_return(type)
150
+ operator.stub(:type => type)
149
151
  end
150
152
 
151
153
  context 'type' do
@@ -154,7 +156,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
154
156
  :boolean
155
157
  end
156
158
 
157
- it { is_expected.to eq(Metasploit::Model::Search::Operation::Boolean) }
159
+ it { should == Metasploit::Model::Search::Operation::Boolean }
158
160
  end
159
161
 
160
162
  context 'with :date' do
@@ -162,7 +164,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
162
164
  :date
163
165
  end
164
166
 
165
- it { is_expected.to eq(Metasploit::Model::Search::Operation::Date) }
167
+ it { should == Metasploit::Model::Search::Operation::Date }
166
168
  end
167
169
 
168
170
  context 'with set: :integer' do
@@ -172,7 +174,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
172
174
  }
173
175
  end
174
176
 
175
- it { is_expected.to eq(Metasploit::Model::Search::Operation::Set::Integer) }
177
+ it { should == Metasploit::Model::Search::Operation::Set::Integer }
176
178
  end
177
179
 
178
180
  context 'with set: :string' do
@@ -182,7 +184,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
182
184
  }
183
185
  end
184
186
 
185
- it { is_expected.to eq(Metasploit::Model::Search::Operation::Set::String) }
187
+ it { should == Metasploit::Model::Search::Operation::Set::String }
186
188
  end
187
189
 
188
190
  context 'with :integer' do
@@ -190,7 +192,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
190
192
  :integer
191
193
  end
192
194
 
193
- it { is_expected.to eq(Metasploit::Model::Search::Operation::Integer) }
195
+ it { should == Metasploit::Model::Search::Operation::Integer }
194
196
  end
195
197
 
196
198
  context 'with :string' do
@@ -198,7 +200,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
198
200
  :string
199
201
  end
200
202
 
201
- it { is_expected.to eq(Metasploit::Model::Search::Operation::String) }
203
+ it { should == Metasploit::Model::Search::Operation::String }
202
204
  end
203
205
 
204
206
  context 'with nil' do
@@ -211,7 +213,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
211
213
  end
212
214
 
213
215
  before(:each) do
214
- allow(operator).to receive(:name).and_return(name)
216
+ operator.stub(:name => name)
215
217
  end
216
218
 
217
219
  it 'should raise ArgumentError' do
@@ -231,7 +233,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
231
233
  end
232
234
 
233
235
  before(:each) do
234
- allow(operator).to receive(:type).and_return(type)
236
+ operator.stub(:type => type)
235
237
  end
236
238
 
237
239
  context 'type' do
@@ -240,7 +242,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
240
242
  :boolean
241
243
  end
242
244
 
243
- it { is_expected.to eq('Metasploit::Model::Search::Operation::Boolean') }
245
+ it { should == 'Metasploit::Model::Search::Operation::Boolean' }
244
246
  end
245
247
 
246
248
  context 'with :date' do
@@ -248,7 +250,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
248
250
  :date
249
251
  end
250
252
 
251
- it { is_expected.to eq('Metasploit::Model::Search::Operation::Date') }
253
+ it { should == 'Metasploit::Model::Search::Operation::Date' }
252
254
  end
253
255
 
254
256
  context 'with set: :integer' do
@@ -258,7 +260,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
258
260
  }
259
261
  end
260
262
 
261
- it { is_expected.to eq('Metasploit::Model::Search::Operation::Set::Integer') }
263
+ it { should == 'Metasploit::Model::Search::Operation::Set::Integer' }
262
264
  end
263
265
 
264
266
  context 'with set: :string' do
@@ -268,7 +270,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
268
270
  }
269
271
  end
270
272
 
271
- it { is_expected.to eq('Metasploit::Model::Search::Operation::Set::String') }
273
+ it { should == 'Metasploit::Model::Search::Operation::Set::String' }
272
274
  end
273
275
 
274
276
  context 'with :integer' do
@@ -276,7 +278,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
276
278
  :integer
277
279
  end
278
280
 
279
- it { is_expected.to eq('Metasploit::Model::Search::Operation::Integer') }
281
+ it { should == 'Metasploit::Model::Search::Operation::Integer' }
280
282
  end
281
283
 
282
284
  context 'with :string' do
@@ -284,7 +286,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
284
286
  :string
285
287
  end
286
288
 
287
- it { is_expected.to eq('Metasploit::Model::Search::Operation::String') }
289
+ it { should == 'Metasploit::Model::Search::Operation::String' }
288
290
  end
289
291
 
290
292
  context 'with nil' do
@@ -297,7 +299,7 @@ RSpec.describe Metasploit::Model::Search::Operator::Single, type: :model do
297
299
  end
298
300
 
299
301
  before(:each) do
300
- allow(operator).to receive(:name).and_return(name)
302
+ operator.stub(:name => name)
301
303
  end
302
304
 
303
305
  it 'should raise ArgumentError' do
@@ -1,6 +1,8 @@
1
- RSpec.describe Metasploit::Model::Search::Query, type: :model do
1
+ require 'spec_helper'
2
+
3
+ describe Metasploit::Model::Search::Query do
2
4
  context 'validations' do
3
- it { is_expected.to validate_presence_of :klass }
5
+ it { should validate_presence_of :klass }
4
6
 
5
7
  context 'operations' do
6
8
  let(:errors) do
@@ -43,11 +45,11 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
43
45
  end
44
46
 
45
47
  it 'should have no operations' do
46
- expect(query.operations.length).to eq(0)
48
+ query.operations.length.should == 0
47
49
  end
48
50
 
49
51
  it 'should record error on operations' do
50
- expect(errors).to include(error)
52
+ errors.should include(error)
51
53
  end
52
54
  end
53
55
 
@@ -57,7 +59,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
57
59
  end
58
60
 
59
61
  it 'should not record error on operations' do
60
- expect(errors).not_to include(error)
62
+ errors.should_not include(error)
61
63
  end
62
64
  end
63
65
  end
@@ -73,7 +75,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
73
75
 
74
76
  before(:each) do
75
77
  operation = double('Invalid Operation', :valid? => valid)
76
- allow(query).to receive(:operations).and_return([operation])
78
+ query.stub(:operations).and_return([operation])
77
79
  end
78
80
 
79
81
  context 'with invalid operation' do
@@ -82,7 +84,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
82
84
  end
83
85
 
84
86
  it 'should record error on operations' do
85
- expect(errors).not_to include(error)
87
+ errors.should_not include(error)
86
88
  end
87
89
  end
88
90
 
@@ -92,7 +94,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
92
94
  end
93
95
 
94
96
  it 'should not record error on options' do
95
- expect(errors).not_to include(error)
97
+ errors.should_not include(error)
96
98
  end
97
99
  end
98
100
  end
@@ -115,11 +117,11 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
115
117
  end
116
118
 
117
119
  it 'should include operation with space in value' do
118
- expect(formatted_operations).to include('formatted_operator1:formatted value:1')
120
+ formatted_operations.should include('formatted_operator1:formatted value:1')
119
121
  end
120
122
 
121
123
  it 'should include operation without space in value' do
122
- expect(formatted_operations).to include('formatted_operator2:formatted_value2')
124
+ formatted_operations.should include('formatted_operator2:formatted_value2')
123
125
  end
124
126
  end
125
127
 
@@ -170,7 +172,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
170
172
  end
171
173
 
172
174
  it 'should equal attribute passed to #initialize' do
173
- expect(formatted_operations).to eq(expected_formatted_operations)
175
+ formatted_operations.should == expected_formatted_operations
174
176
  end
175
177
  end
176
178
 
@@ -206,7 +208,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
206
208
  end
207
209
 
208
210
  it 'should parse #formatted with formatted_operations' do
209
- expect(described_class).to receive(:formatted_operations).with(formatted).and_return([])
211
+ described_class.should_receive(:formatted_operations).with(formatted).and_return([])
210
212
 
211
213
  formatted_operations
212
214
  end
@@ -230,7 +232,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
230
232
  end
231
233
 
232
234
  it 'should use attribute passed to #initialize' do
233
- expect(operations).to eq(expected_operations)
235
+ operations.should == expected_operations
234
236
  end
235
237
  end
236
238
 
@@ -270,7 +272,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
270
272
  end
271
273
 
272
274
  it 'should call #formatted_operations' do
273
- expect(query).to receive(:formatted_operations).and_return([])
275
+ query.should_receive(:formatted_operations).and_return([])
274
276
 
275
277
  operations
276
278
  end
@@ -297,14 +299,14 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
297
299
  :boolean
298
300
  end
299
301
 
300
- it { is_expected.to be_a Metasploit::Model::Search::Operation::Boolean }
302
+ it { should be_a Metasploit::Model::Search::Operation::Boolean }
301
303
 
302
304
  context "with 'true'" do
303
305
  let(:formatted_value) do
304
306
  'true'
305
307
  end
306
308
 
307
- it { is_expected.to be_valid }
309
+ it { should be_valid }
308
310
  end
309
311
 
310
312
  context "with 'false'" do
@@ -312,7 +314,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
312
314
  'false'
313
315
  end
314
316
 
315
- it { is_expected.to be_valid }
317
+ it { should be_valid }
316
318
  end
317
319
 
318
320
  context "without 'false' or 'true'" do
@@ -320,7 +322,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
320
322
  'no'
321
323
  end
322
324
 
323
- it { is_expected.to_not be_valid }
325
+ it { should_not be_valid }
324
326
  end
325
327
  end
326
328
 
@@ -329,14 +331,14 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
329
331
  :date
330
332
  end
331
333
 
332
- it { is_expected.to be_a Metasploit::Model::Search::Operation::Date }
334
+ it { should be_a Metasploit::Model::Search::Operation::Date }
333
335
 
334
336
  context 'with date' do
335
337
  let(:formatted_value) do
336
338
  Date.today.to_s
337
339
  end
338
340
 
339
- it { is_expected.to be_valid }
341
+ it { should be_valid }
340
342
  end
341
343
 
342
344
  context 'without date' do
@@ -344,7 +346,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
344
346
  'yesterday'
345
347
  end
346
348
 
347
- it { is_expected.to_not be_valid }
349
+ it { should_not be_valid }
348
350
  end
349
351
  end
350
352
 
@@ -353,14 +355,14 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
353
355
  :integer
354
356
  end
355
357
 
356
- it { is_expected.to be_a Metasploit::Model::Search::Operation::Integer }
358
+ it { should be_a Metasploit::Model::Search::Operation::Integer }
357
359
 
358
360
  context 'with integer' do
359
361
  let(:formatted_value) do
360
362
  '100'
361
363
  end
362
364
 
363
- it { is_expected.to be_valid }
365
+ it { should be_valid }
364
366
  end
365
367
 
366
368
  context 'with float' do
@@ -368,7 +370,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
368
370
  '100.5'
369
371
  end
370
372
 
371
- it { is_expected.to be_invalid }
373
+ it { should be_invalid }
372
374
  end
373
375
 
374
376
  context 'with integer embedded in text' do
@@ -376,7 +378,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
376
378
  'a2c'
377
379
  end
378
380
 
379
- it { is_expected.to be_invalid }
381
+ it { should be_invalid }
380
382
  end
381
383
  end
382
384
 
@@ -385,14 +387,14 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
385
387
  :string
386
388
  end
387
389
 
388
- it { is_expected.to be_a Metasploit::Model::Search::Operation::String }
390
+ it { should be_a Metasploit::Model::Search::Operation::String }
389
391
 
390
392
  context 'with value' do
391
393
  let(:formatted_value) do
392
394
  'formatted_value'
393
395
  end
394
396
 
395
- it { is_expected.to be_valid }
397
+ it { should be_valid }
396
398
  end
397
399
 
398
400
  context 'without value' do
@@ -400,7 +402,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
400
402
  ''
401
403
  end
402
404
 
403
- it { is_expected.to_not be_valid }
405
+ it { should_not be_valid }
404
406
  end
405
407
  end
406
408
  end
@@ -418,9 +420,9 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
418
420
  'unknown_value'
419
421
  end
420
422
 
421
- it { is_expected.to be_a Metasploit::Model::Search::Operation::Base }
423
+ it { should be_a Metasploit::Model::Search::Operation::Base }
422
424
 
423
- it { is_expected.to be_invalid }
425
+ it { should be_invalid }
424
426
  end
425
427
  end
426
428
  end
@@ -466,7 +468,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
466
468
  end
467
469
 
468
470
  it 'should have correct number of groups' do
469
- expect(operations_by_operator.length).to eq(@operators.length)
471
+ operations_by_operator.length.should == @operators.length
470
472
  end
471
473
 
472
474
  it 'should have correct value for each operator' do
@@ -487,7 +489,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
487
489
  query
488
490
  end
489
491
 
490
- it { is_expected.to be_valid }
492
+ it { should be_valid }
491
493
  end
492
494
  end
493
495
 
@@ -501,7 +503,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
501
503
  query
502
504
  end
503
505
 
504
- it { is_expected.to_not be_valid }
506
+ it { should_not be_valid }
505
507
  end
506
508
  end
507
509
  end
@@ -540,7 +542,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
540
542
 
541
543
  context 'with String' do
542
544
  it 'should find operator' do
543
- expect(parse_operator).to eq(@operator)
545
+ parse_operator.should == @operator
544
546
  end
545
547
  end
546
548
 
@@ -550,7 +552,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
550
552
  end
551
553
 
552
554
  it 'should find operator' do
553
- expect(parse_operator).to eq(@operator)
555
+ parse_operator.should == @operator
554
556
  end
555
557
  end
556
558
  end
@@ -560,7 +562,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
560
562
  'unknown_operator'
561
563
  end
562
564
 
563
- it { is_expected.to be_a Metasploit::Model::Search::Operator::Null }
565
+ it { should be_a Metasploit::Model::Search::Operator::Null }
564
566
  end
565
567
  end
566
568
 
@@ -597,7 +599,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
597
599
  tree
598
600
  end
599
601
 
600
- it { is_expected.to be_a Metasploit::Model::Search::Group::Intersection }
602
+ it { should be_a Metasploit::Model::Search::Group::Intersection }
601
603
 
602
604
  context 'children' do
603
605
  subject(:children) do
@@ -606,17 +608,17 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
606
608
 
607
609
  it 'should be an Array<Metasploit::Model::Search::Group::Union>' do
608
610
  children.each do |child|
609
- expect(child).to be_a Metasploit::Model::Search::Group::Union
611
+ child.should be_a Metasploit::Model::Search::Group::Union
610
612
  end
611
613
  end
612
614
 
613
615
  it 'should have same operator for each child of a union' do
614
616
  children.each do |child|
615
- operator_set = child.children.inject(Set.new) { |block_operator_set, operation|
616
- block_operator_set.add operation.operator
617
+ operator_set = child.children.inject(Set.new) { |operator_set, operation|
618
+ operator_set.add operation.operator
617
619
  }
618
620
 
619
- expect(operator_set.length).to eq(1)
621
+ operator_set.length.should == 1
620
622
  end
621
623
  end
622
624
 
@@ -633,7 +635,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
633
635
 
634
636
  it 'should be Array<Metasploit::Model::Search::Operation::Base>' do
635
637
  grandchildren.each do |grandchild|
636
- expect(grandchild).to be_a Metasploit::Model::Search::Operation::Base
638
+ grandchild.should be_a Metasploit::Model::Search::Operation::Base
637
639
  end
638
640
  end
639
641
  end
@@ -699,15 +701,15 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
699
701
  end
700
702
 
701
703
  it 'should return a new query' do
702
- expect(without_operator).not_to be query
704
+ without_operator.should_not be query
703
705
  end
704
706
 
705
707
  it 'should not have operations on the removed operator' do
706
- expect(without_operator.operations_by_operator[filtered_operator]).to be_blank
708
+ without_operator.operations_by_operator[filtered_operator].should be_blank
707
709
  end
708
710
 
709
711
  it 'should have same #klass as this query' do
710
- expect(without_operator.klass).to eq(query.klass)
712
+ without_operator.klass.should == query.klass
711
713
  end
712
714
 
713
715
  context 'with no other operators' do
@@ -717,11 +719,11 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
717
719
  ]
718
720
  end
719
721
 
720
- it { is_expected.to_not be_valid }
722
+ it { should_not be_valid }
721
723
  end
722
724
 
723
725
  context 'with other operators' do
724
- it { is_expected.to be_valid }
726
+ it { should be_valid }
725
727
  end
726
728
  end
727
729
 
@@ -733,7 +735,7 @@ RSpec.describe Metasploit::Model::Search::Query, type: :model do
733
735
  end
734
736
 
735
737
  it 'should return this query' do
736
- expect(without_operator).to be query
738
+ without_operator.should be query
737
739
  end
738
740
  end
739
741
  end