# HG changeset patch # User Kenneth Chu <ksiuhengchu@gitlab.com> # Date 1620815566 -36000 # Wed May 12 20:32:46 2021 +1000 # Node ID fc1c18ccac949488271d376d31e612c45611c8f7 # Parent 650f0a15660f62ebefdc34dfaa6ef1e5bc860086 Explicitly mock that the nginx service is down diff --git a/spec/chef/letsencrypt/resources/letsencrypt_certificate_spec.rb b/spec/chef/letsencrypt/resources/letsencrypt_certificate_spec.rb --- a/spec/chef/letsencrypt/resources/letsencrypt_certificate_spec.rb +++ b/spec/chef/letsencrypt/resources/letsencrypt_certificate_spec.rb @@ -102,6 +102,11 @@ end context 'when NGINX is not running' do + before do + allow_any_instance_of(OmnibusHelper).to receive(:service_up?).and_return(false) + allow_any_instance_of(OmnibusHelper).to receive(:service_up?).with('nginx').and_return(false) + end + it 'does not attempt to create a certificate' do expect(chef_run).not_to create_acme_certificate('staging') expect(chef_run).not_to create_acme_certificate('production')