metasploit_data_models 0.24.0 → 0.24.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 +3 -3
- data/Gemfile +1 -3
- data/app/models/metasploit_data_models/ip_address/v4/segmented.rb +1 -1
- data/app/models/metasploit_data_models/search/visitor/where.rb +1 -1
- data/app/validators/password_is_strong_validator.rb +1 -1
- data/lib/mdm/host/operating_system_normalization.rb +0 -10
- data/lib/metasploit_data_models/version.rb +2 -2
- data/metasploit_data_models.gemspec +1 -1
- data/spec/app/models/mdm/api_key_spec.rb +1 -3
- data/spec/app/models/mdm/client_spec.rb +9 -11
- data/spec/app/models/mdm/cred_spec.rb +42 -54
- data/spec/app/models/mdm/event_spec.rb +21 -23
- data/spec/app/models/mdm/exploit_attempt_spec.rb +19 -21
- data/spec/app/models/mdm/exploited_host_spec.rb +11 -13
- data/spec/app/models/mdm/host_detail_spec.rb +15 -17
- data/spec/app/models/mdm/host_spec.rb +261 -260
- data/spec/app/models/mdm/host_tag_spec.rb +6 -8
- data/spec/app/models/mdm/listener_spec.rb +30 -32
- data/spec/app/models/mdm/loot_spec.rb +21 -23
- data/spec/app/models/mdm/macro_spec.rb +1 -3
- data/spec/app/models/mdm/mod_ref_spec.rb +1 -3
- data/spec/app/models/mdm/module/action_spec.rb +10 -12
- data/spec/app/models/mdm/module/arch_spec.rb +10 -12
- data/spec/app/models/mdm/module/author_spec.rb +22 -17
- data/spec/app/models/mdm/module/detail_spec.rb +184 -75
- data/spec/app/models/mdm/module/mixin_spec.rb +10 -12
- data/spec/app/models/mdm/module/platform_spec.rb +10 -12
- data/spec/app/models/mdm/module/ref_spec.rb +10 -12
- data/spec/app/models/mdm/module/target_spec.rb +13 -15
- data/spec/app/models/mdm/nexpose_console_spec.rb +35 -37
- data/spec/app/models/mdm/note_spec.rb +23 -25
- data/spec/app/models/mdm/profile_spec.rb +1 -3
- data/spec/app/models/mdm/ref_spec.rb +10 -12
- data/spec/app/models/mdm/route_spec.rb +6 -8
- data/spec/app/models/mdm/service_spec.rb +38 -40
- data/spec/app/models/mdm/session_event_spec.rb +10 -12
- data/spec/app/models/mdm/session_spec.rb +13 -15
- data/spec/app/models/mdm/tag_spec.rb +29 -29
- data/spec/app/models/mdm/task_cred_spec.rb +9 -11
- data/spec/app/models/mdm/task_host_spec.rb +9 -11
- data/spec/app/models/mdm/task_service_spec.rb +9 -11
- data/spec/app/models/mdm/task_session_spec.rb +7 -9
- data/spec/app/models/mdm/task_spec.rb +27 -29
- data/spec/app/models/mdm/user_spec.rb +17 -19
- data/spec/app/models/mdm/vuln_attempt_spec.rb +14 -16
- data/spec/app/models/mdm/vuln_detail_spec.rb +26 -28
- data/spec/app/models/mdm/vuln_ref_spec.rb +8 -10
- data/spec/app/models/mdm/vuln_spec.rb +24 -26
- data/spec/app/models/mdm/web_form_spec.rb +11 -13
- data/spec/app/models/mdm/web_page_spec.rb +19 -21
- data/spec/app/models/mdm/web_site_spec.rb +21 -23
- data/spec/app/models/mdm/web_vuln_spec.rb +63 -65
- data/spec/app/models/mdm/wmap_request_spec.rb +1 -3
- data/spec/app/models/mdm/wmap_target_spec.rb +1 -3
- data/spec/app/models/mdm/workspace_spec.rb +97 -100
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +3 -5
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +13 -15
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +10 -12
- data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +21 -23
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +9 -11
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +21 -23
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +22 -15
- data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +18 -20
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +6 -8
- data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +2 -4
- data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +6 -8
- data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +9 -11
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +5 -7
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +17 -19
- data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +5 -7
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +61 -23
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +8 -10
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +54 -46
- data/spec/dummy/db/structure.sql +1 -0
- data/spec/lib/base64_serializer_spec.rb +19 -19
- data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +18 -12
- data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +4 -6
- data/spec/lib/metasploit_data_models/match/child_spec.rb +2 -4
- data/spec/lib/metasploit_data_models/match/parent_spec.rb +4 -6
- data/spec/lib/metasploit_data_models/version_spec.rb +3 -5
- data/spec/spec_helper.rb +72 -6
- data/spec/support/shared/examples/mdm/module/detail/does_not_support_stance_with_mtype.rb +2 -2
- data/spec/support/shared/examples/mdm/module/detail/supports_stance_with_mtype.rb +4 -4
- data/spec/support/shared/examples/metasploit_data_models/search/operation/ipaddress/match.rb +2 -2
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_metasploit_model_search_operation_base.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_equality.rb +3 -3
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_metasploit_model_search_group_base.rb +7 -6
- metadata +6 -6
data/spec/dummy/db/structure.sql
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe MetasploitDataModels::Base64Serializer do
|
3
|
+
RSpec.describe MetasploitDataModels::Base64Serializer do
|
4
4
|
let(:base64_marshaled) do
|
5
5
|
marshaled = Marshal.dump(unserialized)
|
6
6
|
|
@@ -30,7 +30,7 @@ describe MetasploitDataModels::Base64Serializer do
|
|
30
30
|
|
31
31
|
context 'CONSTANTS' do
|
32
32
|
it 'should define DEFAULT' do
|
33
|
-
described_class::DEFAULT.
|
33
|
+
expect(described_class::DEFAULT).to eq(default)
|
34
34
|
end
|
35
35
|
|
36
36
|
context 'LOADERS' do
|
@@ -38,36 +38,36 @@ describe MetasploitDataModels::Base64Serializer do
|
|
38
38
|
first = described_class::LOADERS[0]
|
39
39
|
deserialized = first.call(base64_marshaled)
|
40
40
|
|
41
|
-
deserialized.
|
41
|
+
expect(deserialized).to eq(unserialized)
|
42
42
|
end
|
43
43
|
|
44
44
|
it 'should fallback to the old YAML format second' do
|
45
45
|
second = described_class::LOADERS[1]
|
46
46
|
deserialized = second.call(yaml)
|
47
47
|
|
48
|
-
deserialized.
|
48
|
+
expect(deserialized).to eq(unserialized)
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should finally give up and just return the value' do
|
52
52
|
last = described_class::LOADERS.last
|
53
53
|
deserialized = last.call(unserialized)
|
54
54
|
|
55
|
-
deserialized.
|
55
|
+
expect(deserialized).to eq(unserialized)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
60
|
context '#default' do
|
61
61
|
it 'should default to {}' do
|
62
|
-
base64_serializer.default.
|
62
|
+
expect(base64_serializer.default).to eq({})
|
63
63
|
end
|
64
64
|
|
65
65
|
it 'should return a duplicate' do
|
66
66
|
duplicate = base64_serializer.default
|
67
|
-
value =
|
67
|
+
value = double('Value')
|
68
68
|
duplicate[:key] = value
|
69
69
|
|
70
|
-
duplicate.
|
70
|
+
expect(duplicate).not_to eq(base64_serializer.default)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
@@ -75,7 +75,7 @@ describe MetasploitDataModels::Base64Serializer do
|
|
75
75
|
it 'should output Base64 encoded marshaled data' do
|
76
76
|
dumped = base64_serializer.dump(unserialized)
|
77
77
|
|
78
|
-
dumped.
|
78
|
+
expect(dumped).to eq(base64_marshaled)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -105,21 +105,21 @@ describe MetasploitDataModels::Base64Serializer do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
it 'should have :default in attributes' do
|
108
|
-
attributes.
|
108
|
+
expect(attributes).to have_key(:default)
|
109
109
|
end
|
110
110
|
|
111
111
|
it 'should set default to :default value' do
|
112
|
-
base64_serializer.default.
|
112
|
+
expect(base64_serializer.default).to eq(attributes[:default])
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
116
|
context 'without :default' do
|
117
117
|
it 'should not have :default in attributes' do
|
118
|
-
attributes.
|
118
|
+
expect(attributes).not_to have_key(:default)
|
119
119
|
end
|
120
120
|
|
121
121
|
it 'should default #default to DEFAULT' do
|
122
|
-
base64_serializer.default.
|
122
|
+
expect(base64_serializer.default).to eq(default)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -131,11 +131,11 @@ describe MetasploitDataModels::Base64Serializer do
|
|
131
131
|
end
|
132
132
|
|
133
133
|
it 'should return #default' do
|
134
|
-
default =
|
135
|
-
base64_serializer.
|
134
|
+
default = double('Default')
|
135
|
+
allow(base64_serializer).to receive(:default).and_return(default)
|
136
136
|
deserialized = base64_serializer.load(serialized)
|
137
137
|
|
138
|
-
deserialized.
|
138
|
+
expect(deserialized).to eq(default)
|
139
139
|
end
|
140
140
|
end
|
141
141
|
|
@@ -143,7 +143,7 @@ describe MetasploitDataModels::Base64Serializer do
|
|
143
143
|
it 'should return unserialized' do
|
144
144
|
deserialized = base64_serializer.load(base64_marshaled)
|
145
145
|
|
146
|
-
deserialized.
|
146
|
+
expect(deserialized).to eq(unserialized)
|
147
147
|
end
|
148
148
|
|
149
149
|
end
|
@@ -152,7 +152,7 @@ describe MetasploitDataModels::Base64Serializer do
|
|
152
152
|
it 'should return unserialized' do
|
153
153
|
deserialized = base64_serializer.load(yaml)
|
154
154
|
|
155
|
-
deserialized.
|
155
|
+
expect(deserialized).to eq(unserialized)
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
@@ -165,7 +165,7 @@ describe MetasploitDataModels::Base64Serializer do
|
|
165
165
|
it 'should return raw value' do
|
166
166
|
deserialized = base64_serializer.load(raw_value)
|
167
167
|
|
168
|
-
deserialized.
|
168
|
+
expect(deserialized).to eq(raw_value)
|
169
169
|
end
|
170
170
|
end
|
171
171
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::IPAddress::CIDR do
|
1
|
+
RSpec.describe MetasploitDataModels::IPAddress::CIDR do
|
4
2
|
subject(:including_class_instance) {
|
5
3
|
including_class.new(
|
6
4
|
value: formatted_value
|
@@ -80,7 +78,7 @@ describe MetasploitDataModels::IPAddress::CIDR do
|
|
80
78
|
described_class::SEPARATOR
|
81
79
|
}
|
82
80
|
|
83
|
-
it {
|
81
|
+
it { is_expected.to eq('/') }
|
84
82
|
end
|
85
83
|
end
|
86
84
|
|
@@ -110,7 +108,7 @@ describe MetasploitDataModels::IPAddress::CIDR do
|
|
110
108
|
true
|
111
109
|
}
|
112
110
|
|
113
|
-
it {
|
111
|
+
it { is_expected.not_to include(invalid_error) }
|
114
112
|
end
|
115
113
|
|
116
114
|
context 'without valid' do
|
@@ -118,7 +116,7 @@ describe MetasploitDataModels::IPAddress::CIDR do
|
|
118
116
|
false
|
119
117
|
}
|
120
118
|
|
121
|
-
it {
|
119
|
+
it { is_expected.to include(invalid_error) }
|
122
120
|
end
|
123
121
|
end
|
124
122
|
|
@@ -131,7 +129,7 @@ describe MetasploitDataModels::IPAddress::CIDR do
|
|
131
129
|
I18n.translate!('errors.messages.blank')
|
132
130
|
}
|
133
131
|
|
134
|
-
it {
|
132
|
+
it { is_expected.to include(blank_error) }
|
135
133
|
end
|
136
134
|
end
|
137
135
|
|
@@ -166,7 +164,7 @@ describe MetasploitDataModels::IPAddress::CIDR do
|
|
166
164
|
end
|
167
165
|
}
|
168
166
|
|
169
|
-
it {
|
167
|
+
it { is_expected.to be_nil }
|
170
168
|
end
|
171
169
|
end
|
172
170
|
|
@@ -208,8 +206,8 @@ describe MetasploitDataModels::IPAddress::CIDR do
|
|
208
206
|
regexp.names
|
209
207
|
}
|
210
208
|
|
211
|
-
it {
|
212
|
-
it {
|
209
|
+
it { is_expected.to include 'address' }
|
210
|
+
it { is_expected.to include 'prefix_length' }
|
213
211
|
end
|
214
212
|
end
|
215
213
|
|
@@ -222,9 +220,17 @@ describe MetasploitDataModels::IPAddress::CIDR do
|
|
222
220
|
Class.new(Metasploit::Model::Base) {
|
223
221
|
attr_accessor :value
|
224
222
|
}.tap { |address_class|
|
223
|
+
outer_segment_class = self.segment_class
|
224
|
+
|
225
|
+
address_class.define_singleton_method(:segment_class) do
|
226
|
+
outer_segment_class
|
227
|
+
end
|
225
228
|
|
226
|
-
|
227
|
-
|
229
|
+
outer_segment_count = self.segment_count
|
230
|
+
|
231
|
+
address_class.define_singleton_method(:segment_count) do
|
232
|
+
outer_segment_count
|
233
|
+
end
|
228
234
|
}
|
229
235
|
}
|
230
236
|
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::IPAddress::Range do
|
1
|
+
RSpec.describe MetasploitDataModels::IPAddress::Range do
|
4
2
|
subject(:range) {
|
5
3
|
range_class.new
|
6
4
|
}
|
@@ -35,7 +33,7 @@ describe MetasploitDataModels::IPAddress::Range do
|
|
35
33
|
'invalid_value'
|
36
34
|
}
|
37
35
|
|
38
|
-
it {
|
36
|
+
it { is_expected.to be_nil }
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
@@ -44,7 +42,7 @@ describe MetasploitDataModels::IPAddress::Range do
|
|
44
42
|
nil
|
45
43
|
}
|
46
44
|
|
47
|
-
it {
|
45
|
+
it { is_expected.to be_nil }
|
48
46
|
end
|
49
47
|
end
|
50
48
|
end
|
@@ -67,7 +65,7 @@ describe MetasploitDataModels::IPAddress::Range do
|
|
67
65
|
described_class::SEPARATOR
|
68
66
|
}
|
69
67
|
|
70
|
-
it {
|
68
|
+
it { is_expected.to eq('-') }
|
71
69
|
end
|
72
70
|
end
|
73
71
|
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::Match::Child do
|
1
|
+
RSpec.describe MetasploitDataModels::Match::Child do
|
4
2
|
let(:extending_class) {
|
5
3
|
# capture as local for Class.new block scope
|
6
4
|
described_class = self.described_class
|
@@ -54,7 +52,7 @@ describe MetasploitDataModels::Match::Child do
|
|
54
52
|
'1,2-3'
|
55
53
|
end
|
56
54
|
|
57
|
-
it {
|
55
|
+
it { is_expected.to be_nil }
|
58
56
|
end
|
59
57
|
end
|
60
58
|
end
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::Match::Parent do
|
1
|
+
RSpec.describe MetasploitDataModels::Match::Parent do
|
4
2
|
let(:including_class) {
|
5
3
|
described_class = self.described_class
|
6
4
|
|
@@ -19,7 +17,7 @@ describe MetasploitDataModels::Match::Parent do
|
|
19
17
|
}
|
20
18
|
|
21
19
|
context 'default' do
|
22
|
-
it {
|
20
|
+
it { is_expected.to eq([]) }
|
23
21
|
end
|
24
22
|
end
|
25
23
|
|
@@ -86,7 +84,7 @@ describe MetasploitDataModels::Match::Parent do
|
|
86
84
|
match_child
|
87
85
|
end
|
88
86
|
|
89
|
-
it {
|
87
|
+
it { is_expected.to be_nil }
|
90
88
|
end
|
91
89
|
end
|
92
90
|
|
@@ -96,7 +94,7 @@ describe MetasploitDataModels::Match::Parent do
|
|
96
94
|
}
|
97
95
|
|
98
96
|
context 'default' do
|
99
|
-
it {
|
97
|
+
it { is_expected.to eq([]) }
|
100
98
|
end
|
101
99
|
|
102
100
|
context 'with class names' do
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
describe MetasploitDataModels::Version do
|
1
|
+
RSpec.describe MetasploitDataModels::Version do
|
4
2
|
context 'CONSTANTS' do
|
5
3
|
context 'MAJOR' do
|
6
4
|
subject(:major) do
|
@@ -17,7 +15,7 @@ describe MetasploitDataModels::Version do
|
|
17
15
|
described_class::MINOR
|
18
16
|
end
|
19
17
|
|
20
|
-
it {
|
18
|
+
it { is_expected.to be_a Integer }
|
21
19
|
end
|
22
20
|
|
23
21
|
context 'PATCH' do
|
@@ -25,7 +23,7 @@ describe MetasploitDataModels::Version do
|
|
25
23
|
described_class::PATCH
|
26
24
|
end
|
27
25
|
|
28
|
-
it {
|
26
|
+
it { is_expected.to be_a Integer }
|
29
27
|
end
|
30
28
|
|
31
29
|
pull_request = ENV['TRAVIS_PULL_REQUEST']
|
data/spec/spec_helper.rb
CHANGED
@@ -22,7 +22,6 @@ end
|
|
22
22
|
|
23
23
|
require File.expand_path('../dummy/config/environment.rb', __FILE__)
|
24
24
|
require 'rspec/rails'
|
25
|
-
require 'rspec/autorun'
|
26
25
|
|
27
26
|
# full backtrace in logs so its easier to trace errors
|
28
27
|
Rails.backtrace_cleaner.remove_silencers!
|
@@ -44,13 +43,80 @@ engines.each do |engine|
|
|
44
43
|
end
|
45
44
|
end
|
46
45
|
|
46
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
47
47
|
RSpec.configure do |config|
|
48
|
-
config.
|
49
|
-
|
50
|
-
|
48
|
+
# rspec-expectations config goes here. You can use an alternate
|
49
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
50
|
+
# assertions if you prefer.
|
51
|
+
config.expect_with :rspec do |expectations|
|
52
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
53
|
+
# and `failure_message` of custom matchers include text for helper methods
|
54
|
+
# defined using `chain`, e.g.:
|
55
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
56
|
+
# # => "be bigger than 2 and smaller than 4"
|
57
|
+
# ...rather than:
|
58
|
+
# # => "be bigger than 2"
|
59
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
51
60
|
end
|
52
61
|
|
53
|
-
config.
|
54
|
-
|
62
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
63
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
64
|
+
config.mock_with :rspec do |mocks|
|
65
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
66
|
+
# a real object. This is generally recommended, and will default to
|
67
|
+
# `true` in RSpec 4.
|
68
|
+
mocks.verify_partial_doubles = true
|
69
|
+
end
|
70
|
+
|
71
|
+
# These two settings work together to allow you to limit a spec run
|
72
|
+
# to individual examples or groups you care about by tagging them with
|
73
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
74
|
+
# get run.
|
75
|
+
config.filter_run :focus
|
76
|
+
config.run_all_when_everything_filtered = true
|
77
|
+
|
78
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
79
|
+
# recommended. For more details, see:
|
80
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
81
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
82
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
83
|
+
config.disable_monkey_patching!
|
84
|
+
|
85
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
86
|
+
# be too noisy due to issues in dependencies.
|
87
|
+
config.warnings = true
|
88
|
+
|
89
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
90
|
+
# file, and it's useful to allow more verbose output when running an
|
91
|
+
# individual spec file.
|
92
|
+
if config.files_to_run.one?
|
93
|
+
# Use the documentation formatter for detailed output,
|
94
|
+
# unless a formatter has already been configured
|
95
|
+
# (e.g. via a command-line flag).
|
96
|
+
config.default_formatter = 'doc'
|
97
|
+
end
|
98
|
+
|
99
|
+
# Print the 10 slowest examples and example groups at the
|
100
|
+
# end of the spec run, to help surface which specs are running
|
101
|
+
# particularly slow.
|
102
|
+
config.profile_examples = 10
|
103
|
+
|
104
|
+
# Run specs in random order to surface order dependencies. If you find an
|
105
|
+
# order dependency and want to debug it, you can fix the order by providing
|
106
|
+
# the seed, which is printed after each run.
|
107
|
+
# --seed 1234
|
55
108
|
config.order = :random
|
109
|
+
|
110
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
111
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
112
|
+
# test failures related to randomization by passing the same `--seed` value
|
113
|
+
# as the one that triggered the failure.
|
114
|
+
Kernel.srand config.seed
|
115
|
+
|
116
|
+
config.use_transactional_fixtures = true
|
117
|
+
|
118
|
+
config.before(:each) do
|
119
|
+
# Rex is only available when testing with metasploit-framework or pro, so stub out the methods that require it
|
120
|
+
allow_any_instance_of(Mdm::Workspace).to receive(:valid_ip_or_range?).and_return(true)
|
121
|
+
end
|
56
122
|
end
|
@@ -6,7 +6,7 @@ shared_examples_for 'Mdm::Module::Detail does not support stance with mtype' do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
it 'should return false for supports_stance?' do
|
9
|
-
detail.supports_stance
|
9
|
+
expect(detail.supports_stance?).to eq(false)
|
10
10
|
end
|
11
11
|
|
12
12
|
context 'with nil stance' do
|
@@ -14,7 +14,7 @@ shared_examples_for 'Mdm::Module::Detail does not support stance with mtype' do
|
|
14
14
|
nil
|
15
15
|
end
|
16
16
|
|
17
|
-
it {
|
17
|
+
it { is_expected.to be_valid }
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|