metasploit-model 0.30.0 → 0.30.1.pre.rspec.pre.3.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -4
- data/Gemfile +2 -2
- data/lib/metasploit/model/version.rb +3 -1
- data/spec/app/models/metasploit/model/association/reflection_spec.rb +5 -7
- data/spec/app/models/metasploit/model/search/group/base_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/group/intersection_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/group/union_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/association_spec.rb +7 -9
- data/spec/app/models/metasploit/model/search/operation/base_spec.rb +5 -7
- data/spec/app/models/metasploit/model/search/operation/boolean_spec.rb +14 -11
- data/spec/app/models/metasploit/model/search/operation/date_spec.rb +6 -8
- data/spec/app/models/metasploit/model/search/operation/group/base_spec.rb +12 -14
- data/spec/app/models/metasploit/model/search/operation/group/intersection_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/group/union_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/null_spec.rb +4 -6
- data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operation/set_spec.rb +4 -6
- data/spec/app/models/metasploit/model/search/operation/string_spec.rb +2 -4
- data/spec/app/models/metasploit/model/search/operator/association_spec.rb +6 -8
- data/spec/app/models/metasploit/model/search/operator/attribute_spec.rb +12 -14
- data/spec/app/models/metasploit/model/search/operator/base_spec.rb +3 -5
- data/spec/app/models/metasploit/model/search/operator/delegation_spec.rb +13 -11
- data/spec/app/models/metasploit/model/search/operator/group/base_spec.rb +5 -7
- data/spec/app/models/metasploit/model/search/operator/group/intersection_spec.rb +3 -5
- data/spec/app/models/metasploit/model/search/operator/group/union_spec.rb +3 -5
- data/spec/app/models/metasploit/model/search/operator/null_spec.rb +5 -7
- data/spec/app/models/metasploit/model/search/operator/single_spec.rb +26 -28
- data/spec/app/models/metasploit/model/search/query_spec.rb +48 -50
- data/spec/app/models/metasploit/model/visitation/visitor_spec.rb +7 -9
- data/spec/app/validators/ip_format_validator_spec.rb +7 -9
- data/spec/app/validators/nil_validator_spec.rb +3 -5
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +17 -19
- data/spec/lib/metasploit/model/association/error_spec.rb +1 -3
- data/spec/lib/metasploit/model/association_spec.rb +8 -10
- data/spec/lib/metasploit/model/base_spec.rb +3 -5
- data/spec/lib/metasploit/model/engine_spec.rb +48 -11
- data/spec/lib/metasploit/model/file_spec.rb +3 -5
- data/spec/lib/metasploit/model/invalid_spec.rb +7 -9
- data/spec/lib/metasploit/model/login/status_spec.rb +1 -3
- data/spec/lib/metasploit/model/nilify_blanks_spec.rb +11 -13
- data/spec/lib/metasploit/model/realm/key_spec.rb +15 -17
- data/spec/lib/metasploit/model/search/association/tree_spec.rb +3 -5
- data/spec/lib/metasploit/model/search/association_spec.rb +2 -4
- data/spec/lib/metasploit/model/search/attribute_spec.rb +6 -8
- data/spec/lib/metasploit/model/search/operation/value/integer_spec.rb +1 -3
- data/spec/lib/metasploit/model/search/operation/value/string_spec.rb +1 -3
- data/spec/lib/metasploit/model/search/operation_spec.rb +11 -13
- data/spec/lib/metasploit/model/search/operator/help_spec.rb +1 -3
- data/spec/lib/metasploit/model/search/with_spec.rb +7 -9
- data/spec/lib/metasploit/model/search_spec.rb +11 -13
- data/spec/lib/metasploit/model/spec/error_spec.rb +2 -4
- data/spec/lib/metasploit/model/spec/i18n_exception_handler_spec.rb +5 -7
- data/spec/lib/metasploit/model/spec/pathname_collision_spec.rb +4 -6
- data/spec/lib/metasploit/model/spec_spec.rb +9 -7
- data/spec/lib/metasploit/model/translation_spec.rb +10 -12
- data/spec/lib/metasploit/model/version_spec.rb +3 -5
- data/spec/lib/metasploit/model/visitation/visit_spec.rb +28 -26
- data/spec/matchers/validate_nilness_of_spec.rb +0 -2
- data/spec/spec_helper.rb +69 -7
- data/spec/support/shared/contexts/metasploit/model/search/operator/union/children.rb +1 -1
- data/spec/support/shared/examples/metasploit/model/search/operation/value/integer.rb +8 -8
- data/spec/support/shared/examples/metasploit/model/search/operation/value/string.rb +5 -5
- data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +18 -16
- data/spec/support/shared/examples/metasploit/model/translation.rb +4 -4
- data/spec/support/shared/examples/search/query.rb +3 -3
- data/spec/support/shared/examples/search_association.rb +2 -2
- data/spec/support/shared/examples/search_attribute.rb +3 -3
- data/spec/support/shared/examples/search_with.rb +3 -3
- metadata +4 -4
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe Metasploit::Model::Search::Operation::Set do
|
1
|
+
RSpec.describe Metasploit::Model::Search::Operation::Set, type: :model do
|
4
2
|
subject(:set) do
|
5
3
|
described_class.new(
|
6
4
|
operator: operator,
|
@@ -97,7 +95,7 @@ describe Metasploit::Model::Search::Operation::Set do
|
|
97
95
|
attribute_set.sample
|
98
96
|
end
|
99
97
|
|
100
|
-
it {
|
98
|
+
it { is_expected.not_to include(error) }
|
101
99
|
end
|
102
100
|
|
103
101
|
context 'without value in attribute_set' do
|
@@ -105,7 +103,7 @@ describe Metasploit::Model::Search::Operation::Set do
|
|
105
103
|
:not_an_member
|
106
104
|
end
|
107
105
|
|
108
|
-
it {
|
106
|
+
it { is_expected.to include(error) }
|
109
107
|
end
|
110
108
|
end
|
111
109
|
|
@@ -118,7 +116,7 @@ describe Metasploit::Model::Search::Operation::Set do
|
|
118
116
|
nil
|
119
117
|
end
|
120
118
|
|
121
|
-
it {
|
119
|
+
it { is_expected.not_to include(error) }
|
122
120
|
end
|
123
121
|
end
|
124
122
|
end
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe Metasploit::Model::Search::Operation::String do
|
1
|
+
RSpec.describe Metasploit::Model::Search::Operation::String, type: :model do
|
4
2
|
context 'validation' do
|
5
|
-
it {
|
3
|
+
it { is_expected.to validate_presence_of(:value) }
|
6
4
|
end
|
7
5
|
|
8
6
|
it_should_behave_like 'Metasploit::Model::Search::Operation::Value::String'
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe Metasploit::Model::Search::Operator::Association do
|
1
|
+
RSpec.describe Metasploit::Model::Search::Operator::Association, type: :model do
|
4
2
|
subject(:operator) do
|
5
3
|
described_class.new(
|
6
4
|
:association => association,
|
@@ -16,11 +14,11 @@ describe Metasploit::Model::Search::Operator::Association do
|
|
16
14
|
double('Metasploit::Model::Search::Operator::Base')
|
17
15
|
end
|
18
16
|
|
19
|
-
it {
|
17
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operator::Base }
|
20
18
|
|
21
19
|
context 'validations' do
|
22
|
-
it {
|
23
|
-
it {
|
20
|
+
it { is_expected.to validate_presence_of(:association) }
|
21
|
+
it { is_expected.to validate_presence_of(:source_operator) }
|
24
22
|
end
|
25
23
|
|
26
24
|
context '#help' do
|
@@ -51,7 +49,7 @@ describe Metasploit::Model::Search::Operator::Association do
|
|
51
49
|
'source_operator_name'
|
52
50
|
}
|
53
51
|
|
54
|
-
it {
|
52
|
+
it { is_expected.to be_a Symbol }
|
55
53
|
|
56
54
|
it 'should be <association>.<source_operator.name>' do
|
57
55
|
expect(name).to eq :"#{association}.#{source_operator_name}"
|
@@ -81,7 +79,7 @@ describe Metasploit::Model::Search::Operator::Association do
|
|
81
79
|
}
|
82
80
|
}
|
83
81
|
|
84
|
-
it {
|
82
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operation::Association }
|
85
83
|
|
86
84
|
context 'Metasploit::Model::Search::Operation::Association' do
|
87
85
|
context '#operator' do
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe Metasploit::Model::Search::Operator::Attribute do
|
4
|
-
it { should be_a Metasploit::Model::Search::Operator::Single }
|
1
|
+
RSpec.describe Metasploit::Model::Search::Operator::Attribute, type: :model do
|
2
|
+
it { is_expected.to be_a Metasploit::Model::Search::Operator::Single }
|
5
3
|
|
6
4
|
context 'CONSTANTS' do
|
7
5
|
context 'TYPES' do
|
@@ -9,30 +7,30 @@ describe Metasploit::Model::Search::Operator::Attribute do
|
|
9
7
|
described_class::TYPES
|
10
8
|
end
|
11
9
|
|
12
|
-
it {
|
13
|
-
it {
|
10
|
+
it { is_expected.to include(:boolean) }
|
11
|
+
it { is_expected.to include(:date) }
|
14
12
|
it {
|
15
|
-
|
13
|
+
is_expected.to include(
|
16
14
|
{
|
17
15
|
set: :integer
|
18
16
|
}
|
19
17
|
)
|
20
18
|
}
|
21
19
|
it {
|
22
|
-
|
20
|
+
is_expected.to include(
|
23
21
|
{
|
24
22
|
set: :string
|
25
23
|
}
|
26
24
|
)
|
27
25
|
}
|
28
|
-
it {
|
29
|
-
it {
|
26
|
+
it { is_expected.to include(:integer) }
|
27
|
+
it { is_expected.to include(:string) }
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
33
31
|
context 'validations' do
|
34
|
-
it {
|
35
|
-
it {
|
32
|
+
it { is_expected.to validate_presence_of(:attribute) }
|
33
|
+
it { is_expected.to ensure_inclusion_of(:type).in_array(described_class::TYPES) }
|
36
34
|
end
|
37
35
|
|
38
36
|
context '#attribute_enumerable' do
|
@@ -77,7 +75,7 @@ describe Metasploit::Model::Search::Operator::Attribute do
|
|
77
75
|
end
|
78
76
|
|
79
77
|
it 'should be #klass #<attribute>_set' do
|
80
|
-
attribute_set.
|
78
|
+
expect(attribute_set).to eq(expected_attribute_set)
|
81
79
|
end
|
82
80
|
end
|
83
81
|
end
|
@@ -98,7 +96,7 @@ describe Metasploit::Model::Search::Operator::Attribute do
|
|
98
96
|
end
|
99
97
|
|
100
98
|
it 'should be #attribute' do
|
101
|
-
name.
|
99
|
+
expect(name).to eq(attribute)
|
102
100
|
end
|
103
101
|
end
|
104
102
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe Metasploit::Model::Search::Operator::Base do
|
1
|
+
RSpec.describe Metasploit::Model::Search::Operator::Base, type: :model do
|
4
2
|
subject(:operator) do
|
5
3
|
described_class.new
|
6
4
|
end
|
@@ -12,12 +10,12 @@ describe Metasploit::Model::Search::Operator::Base do
|
|
12
10
|
|
13
11
|
before(:each) do
|
14
12
|
# have to stub since it's not implemented on base
|
15
|
-
operator.
|
13
|
+
allow(operator).to receive(:name).and_return(name)
|
16
14
|
end
|
17
15
|
end
|
18
16
|
|
19
17
|
context 'validations' do
|
20
|
-
it {
|
18
|
+
it { is_expected.to validate_presence_of(:klass) }
|
21
19
|
end
|
22
20
|
|
23
21
|
context '#name' do
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
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 {
|
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.
|
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.
|
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
|
-
|
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.
|
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.
|
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.
|
105
|
+
allow(operator.class).to receive(:operator_name).and_return(operator_name)
|
104
106
|
|
105
|
-
name.
|
107
|
+
expect(name).to eq(operator_name)
|
106
108
|
end
|
107
109
|
end
|
108
110
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
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.
|
51
|
+
allow(operator).to receive(:children).and_return(children)
|
54
52
|
end
|
55
53
|
|
56
|
-
it {
|
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.
|
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.
|
86
|
+
expect(value).to eq(formatted_value)
|
89
87
|
end
|
90
88
|
end
|
91
89
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
|
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 {
|
9
|
+
it { is_expected.to eq('Metasploit::Model::Search::Operation::Group::Intersection') }
|
12
10
|
end
|
13
11
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
|
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 {
|
9
|
+
it { is_expected.to eq('Metasploit::Model::Search::Operation::Group::Union') }
|
12
10
|
end
|
13
11
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
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 {
|
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].
|
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 {
|
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 {
|
37
|
+
it { is_expected.to eq(Metasploit::Model::Search::Operation::Null) }
|
40
38
|
end
|
41
39
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
|
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 {
|
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 {
|
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 {
|
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.
|
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.
|
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.
|
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.
|
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.
|
136
|
+
allow(operation_class).to receive(:new).and_return(operation)
|
139
137
|
|
140
|
-
operate_on.
|
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.
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
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.
|
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.
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
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 {
|
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.
|
300
|
+
allow(operator).to receive(:name).and_return(name)
|
303
301
|
end
|
304
302
|
|
305
303
|
it 'should raise ArgumentError' do
|