Skip to content

Commit 07695c2

Browse files
committed
(CONT-785) Rubocop Manual Fix 6 - RSpec/StubbedMock
1 parent fe8eff3 commit 07695c2

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ RSpec/ExampleLength:
6161
RSpec/NestedGroups:
6262
Max: 4
6363

64-
# Offense count: 7
65-
RSpec/StubbedMock:
66-
Exclude:
67-
- 'spec/unit/puppet/provider/java_ks/keytool_spec.rb'
68-
6964
# Offense count: 3
7065
# This cop supports unsafe autocorrection (--autocorrect-all).
7166
# Configuration parameters: .

spec/unit/puppet/provider/java_ks/keytool_spec.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686

8787
it 'normally times out after 120 seconds' do
8888
cmd = '/bin/echo testing 1 2 3'
89-
expect(Timeout).to receive(:timeout).with(120, Timeout::Error).and_raise(Timeout::Error)
89+
allow(Timeout).to receive(:timeout).with(120, Timeout::Error).and_raise(Timeout::Error)
9090

9191
expect { provider.run_command(cmd) }.to raise_error Puppet::Error, "Timed out waiting for 'app.example.com' to run keytool"
9292
end
@@ -108,6 +108,7 @@
108108

109109
context 'when using the file based parameters for certificate and private_key' do
110110
# rubocop:disable RSpec/MultipleExpectations
111+
# rubocop:disable RSpec/StubbedMock
111112
it 'converts a certificate to a pkcs12 file' do
112113
allow(provider).to receive(:password).and_return(resource[:password])
113114
allow(File).to receive(:read).with(resource[:private_key]).and_return('private key')
@@ -121,6 +122,7 @@
121122
provider.to_pkcs12("#{temp_dir}testing.stuff")
122123
end
123124
# rubocop:enable RSpec/MultipleExpectations
125+
# rubocop:enable RSpec/StubbedMock
124126
end
125127

126128
context 'when using content based parameters for certificate and private_key' do
@@ -132,6 +134,7 @@
132134
end
133135

134136
# rubocop:disable RSpec/MultipleExpectations
137+
# rubocop:disable RSpec/StubbedMock
135138
it 'converts a certificate to a pkcs12 file' do
136139
allow(provider).to receive(:password).and_return(resource[:password])
137140
allow(File).to receive(:read).with('/tmp/testing.stuff').ordered.and_return('private key')
@@ -145,6 +148,7 @@
145148
provider.to_pkcs12("#{temp_dir}testing.stuff")
146149
end
147150
# rubocop:enable RSpec/MultipleExpectations
151+
# rubocop:enable RSpec/StubbedMock
148152
end
149153
end
150154

0 commit comments

Comments
 (0)