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

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