Closed zilchms closed 1 year ago
diff --git spec/functions/cert_aia_caissuers_spec.rb spec/functions/cert_aia_caissuers_spec.rb
index a076d33..f702d4d 100644
--- spec/functions/cert_aia_caissuers_spec.rb
+++ spec/functions/cert_aia_caissuers_spec.rb
@@ -27,7 +27,8 @@ describe 'cert_aia_caissuers' do
let(:cert) { OpenSSL::X509::Certificate.new }
before do
- allow(File).to receive(:read).and_return('foo')
+ allow(File).to receive(:read).and_call_original
+ allow(File).to receive(:read).with('/path/to/cert').and_return('foo')
end
it 'returns nil if cert does not contains AIA extension' do
diff --git spec/functions/cert_date_valid_spec.rb spec/functions/cert_date_valid_spec.rb
index 8219fff..966bef2 100644
--- spec/functions/cert_date_valid_spec.rb
+++ spec/functions/cert_date_valid_spec.rb
@@ -20,7 +20,8 @@ describe 'cert_date_valid' do
let(:cert) { OpenSSL::X509::Certificate.new }
before do
- allow(File).to receive(:read).and_return('bleh')
+ allow(File).to receive(:read).and_call_original
+ allow(File).to receive(:read).with('/path/to/cert').and_return('bleh')
end
it 'returns false if cert is not valid anymore' do
this fixes the weird function errors by unshadowing File.read
for anything but /path/to/cert
contributes to #161