schubergphilis / chef-acme

Chef cookbook to request SSL certificates at Let's Encrypt
Apache License 2.0
112 stars 74 forks source link

False positive Chefspec matcher `create_acme_certificate()` #84

Closed willis7 closed 1 year ago

willis7 commented 7 years ago
describe 'site-proxy::letsencrypt' do
  context 'When all attributes are default, on debian 8.7' do
    let(:chef_run) { ChefSpec::SoloRunner.new(DEBIAN_OPTS).converge(described_recipe) }

    it 'includes `acme` recipe' do
      expect(chef_run).to include_recipe('acme')
    end

    it 'creates a self signed certificate with attributes' do
      expect(chef_run).to create_acme_selfsigned('my-site.com')
      expect(chef_run).to_not create_acme_certificate('/etc/nginx/ssl/my-site.com.crt')
    end
  end

  context 'When configured for live, on debian 8.7' do
    let(:chef_run) {
      ChefSpec::SoloRunner.new(DEBIAN_OPTS) do |node|
        node.normal['site']['lets_encrypt']['enabled'] = true
      end.converge(described_recipe)
    }

    it 'creates a ca certificate' do
      expect(chef_run).to create_acme_certificate('/etc/nginx/ssl/my-site.com.crt')
      expect(chef_run).to_not create_acme_selfsigned('my-site.com')
    end
  end
end

The output is:

Failures:

  1) site-proxy::letsencrypt When configured for live, on debian 8.7 creates a ca certificate with attributes
     Failure/Error: expect(chef_run).to create_acme_certificate('/etc/nginx/ssl/my-site.com.crt')

       expected "acme_certificate[/etc/nginx/ssl/my-site.com.crt]" with action :create to be in Chef run. Other acme_certificate resources:

I'm really confused with this failure despite having a match. Am I missing something?