Skip to content

Commit 388bfec

Browse files
author
Brent Cook
committed
Land rapid7#6415, update rspec3 conventions
2 parents 6e65d1d + 06a75e1 commit 388bfec

File tree

199 files changed

+432
-421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

199 files changed

+432
-421
lines changed

spec/lib/active_record/connection_adapters/abstract_adapter/connection_pool_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def database_configurations_pathname
1919

2020
# Not all specs require a database connection, and railties aren't being
2121
# used, so have to manually establish connection.
22-
before(:each) do
22+
before(:example) do
2323
ActiveRecord::Base.configurations = database_configurations
2424
spec = ActiveRecord::Base.configurations[Rails.env]
2525
ActiveRecord::Base.establish_connection(spec)
2626
end
2727

28-
after(:each) do
28+
after(:example) do
2929
ActiveRecord::Base.clear_all_connections!
3030
end
3131

@@ -39,7 +39,7 @@ def database_configurations_pathname
3939
Thread.current
4040
end
4141

42-
before(:each) do
42+
before(:example) do
4343
ActiveRecord::Base.connection_pool.connection
4444
end
4545

@@ -92,7 +92,7 @@ def reserved_connection_count
9292
connection_pool.connection
9393
end
9494

95-
after(:each) do
95+
after(:example) do
9696
connection_pool.checkin connection
9797
end
9898

spec/lib/metasploit/framework/credential_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
end
3434

3535
context 'when not paired' do
36-
before(:each) do
36+
before(:example) do
3737
cred_detail.paired = false
3838
end
3939

@@ -53,7 +53,7 @@
5353
end
5454

5555
context 'when paired' do
56-
before(:each) do
56+
before(:example) do
5757
cred_detail.paired = true
5858
end
5959

spec/lib/metasploit/framework/database_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
described_class.configurations_pathnames
9696
}
9797

98-
before(:each) do
98+
before(:example) do
9999
allow(described_class).to receive(:environment_configurations_pathname).and_return(
100100
environment_configurations_pathname
101101
)
@@ -119,7 +119,7 @@
119119
# Callbacks
120120
#
121121

122-
before(:each) do
122+
before(:example) do
123123
allow(described_class).to receive(:user_configurations_pathname).and_return(
124124
user_configurations_pathname
125125
)
@@ -143,7 +143,7 @@
143143
# Callbacks
144144
#
145145

146-
before(:each) do
146+
before(:example) do
147147
allow(described_class).to receive(:project_configurations_pathname).and_return(
148148
project_configurations_pathname
149149
)
@@ -224,7 +224,7 @@
224224
# Callbacks
225225
#
226226

227-
before(:each) do
227+
before(:example) do
228228
allow(described_class).to receive(:project_configurations_pathname).and_return(
229229
project_configurations_pathname
230230
)
@@ -306,7 +306,7 @@
306306
# Callbacks
307307
#
308308

309-
before(:each) do
309+
before(:example) do
310310
allow(described_class).to receive(:project_configurations_pathname).and_return(
311311
project_configurations_pathname
312312
)
@@ -346,7 +346,7 @@
346346
# Callbacks
347347
#
348348

349-
before(:each) do
349+
before(:example) do
350350
allow(described_class).to receive(:user_configurations_pathname).and_return(
351351
user_configurations_pathname
352352
)
@@ -370,7 +370,7 @@
370370
# Callbacks
371371
#
372372

373-
before(:each) do
373+
before(:example) do
374374
allow(described_class).to receive(:project_configurations_pathname).and_return(
375375
project_configurations_pathname
376376
)
@@ -451,7 +451,7 @@
451451
# Callbacks
452452
#
453453

454-
before(:each) do
454+
before(:example) do
455455
allow(described_class).to receive(:project_configurations_pathname).and_return(
456456
project_configurations_pathname
457457
)
@@ -524,7 +524,7 @@
524524
# Callbacks
525525
#
526526

527-
before(:each) do
527+
before(:example) do
528528
allow(described_class).to receive(:project_configurations_pathname).and_return(
529529
project_configurations_pathname
530530
)
@@ -584,7 +584,7 @@
584584
described_class.environment_configurations_pathname
585585
}
586586

587-
around(:each) do |example|
587+
around(:example) do |example|
588588
env_before = ENV.to_hash
589589

590590
begin
@@ -595,7 +595,7 @@
595595
end
596596

597597
context 'with MSF_DATABASE_CONFIG' do
598-
before(:each) do
598+
before(:example) do
599599
ENV['MSF_DATABASE_CONFIG'] = msf_database_config
600600
end
601601

@@ -619,7 +619,7 @@
619619
end
620620

621621
context 'without MSF_DATABASE_CONFIG' do
622-
before(:each) do
622+
before(:example) do
623623
ENV.delete('MSF_DATABASE_CONFIG')
624624
end
625625

@@ -655,15 +655,15 @@
655655
# Callbacks
656656
#
657657

658-
around(:each) do |example|
658+
around(:example) do |example|
659659
begin
660660
example.run
661661
ensure
662662
FileUtils.remove_entry_secure config_root
663663
end
664664
end
665665

666-
before(:each) do
666+
before(:example) do
667667
allow(Msf::Config).to receive(:get_config_root).and_return(config_root)
668668
end
669669

spec/lib/metasploit/framework/jtr/cracker_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
context 'when the user supplied a john_path' do
24-
before(:each) do
24+
before(:example) do
2525
cracker.john_path = john_path
2626
end
2727

@@ -54,7 +54,7 @@
5454
end
5555

5656
describe '#crack_command' do
57-
before(:each) do
57+
before(:example) do
5858
expect(cracker).to receive(:binary_path).and_return john_path
5959
expect(cracker).to receive(:john_session_id).and_return session_id
6060
end
@@ -123,7 +123,7 @@
123123
end
124124

125125
describe '#show_command' do
126-
before(:each) do
126+
before(:example) do
127127
expect(cracker).to receive(:binary_path).and_return john_path
128128
end
129129

@@ -159,7 +159,7 @@
159159
describe 'validations' do
160160
context 'failures' do
161161
context 'file_path validators' do
162-
before(:each) do
162+
before(:example) do
163163
expect(File).to receive(:file?).and_return false
164164
end
165165

@@ -189,7 +189,7 @@
189189
end
190190

191191
context 'executable_path validators' do
192-
before(:each) do
192+
before(:example) do
193193
expect(File).to receive(:executable?).and_return false
194194
end
195195

@@ -203,7 +203,7 @@
203203

204204
context 'successes' do
205205
context 'file_path validators' do
206-
before(:each) do
206+
before(:example) do
207207
expect(File).to receive(:file?).and_return true
208208
end
209209

@@ -233,7 +233,7 @@
233233
end
234234

235235
context 'executable_path validators' do
236-
before(:each) do
236+
before(:example) do
237237
expect(File).to receive(:executable?).and_return true
238238
end
239239

spec/lib/metasploit/framework/login_scanner/chef_webui_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
'New password for the User'
8484
end
8585

86-
before :each do
86+
before :example do
8787
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |cli, req|
8888
if req.opts['uri'] && req.opts['uri'].include?('/users/login_exec') &&
8989
req.opts['data'] &&

spec/lib/metasploit/framework/login_scanner/ftp_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
end
9393

9494
context '#attempt_login' do
95-
before(:each) do
95+
before(:example) do
9696
ftp_scanner.host = '127.0.0.1'
9797
ftp_scanner.port = 21
9898
ftp_scanner.connection_timeout = 30

spec/lib/metasploit/framework/login_scanner/glassfish_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
'<title>Deploy Enterprise Applications/Modules</title>'
119119
end
120120

121-
before :each do
121+
before :example do
122122
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |cli, req|
123123
if req.opts['uri'] && req.opts['uri'].include?('j_security_check') &&
124124
req.opts['data'] &&
@@ -158,7 +158,7 @@
158158
'<title>Deploy Enterprise Applications/Modules</title>'
159159
end
160160

161-
before :each do
161+
before :example do
162162
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |cli, req|
163163
if req.opts['uri'] && req.opts['uri'].include?('j_security_check') &&
164164
req.opts['data'] &&

spec/lib/metasploit/framework/login_scanner/http_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
let(:response) { Rex::Proto::Http::Response.new(200, 'OK') }
1616

17-
before(:each) do
17+
before(:example) do
1818
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:request_cgi).with(any_args)
1919
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv).with(any_args).and_return(response)
2020
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:set_config).with(any_args)

spec/lib/metasploit/framework/login_scanner/ipboard_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
context "when invalid IPBoard application" do
5656
let(:not_found_warning) { 'Server nonce not present, potentially not an IP Board install or bad URI.' }
57-
before :each do
57+
before :example do
5858
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |cli, req|
5959
Rex::Proto::Http::Response.new(200)
6060
end
@@ -70,7 +70,7 @@
7070
end
7171

7272
context "when valid IPBoard application" do
73-
before :each do
73+
before :example do
7474
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv) do |cli, req|
7575

7676
if req.opts['uri'] && req.opts['uri'].include?('index.php') &&

spec/lib/metasploit/framework/login_scanner/manageengine_desktop_central_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
Rex::Proto::Http::Response.new(200, 'OK')
3939
end
4040

41-
before(:each) do
41+
before(:example) do
4242
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:request_cgi).with(any_args)
4343
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:send_recv).with(any_args).and_return(response)
4444
allow_any_instance_of(Rex::Proto::Http::Client).to receive(:set_config).with(any_args)

0 commit comments

Comments
 (0)