From 3c507e3a0ae7f2b880917097f35d1be0dbc56a7e Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Thu, 10 Aug 2017 11:21:02 -0500 Subject: [PATCH 1/2] Fix facts usage when selecting repo class This fixes a bug introduced in #357 where Debian repositories were being selected on Ubuntu. --- manifests/repo.pp | 2 +- spec/classes/php_repo_spec.rb | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 spec/classes/php_repo_spec.rb diff --git a/manifests/repo.pp b/manifests/repo.pp index f7b8ae30..b02e65ae 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -7,7 +7,7 @@ case $facts['os']['family'] { 'Debian': { # no contain here because apt does that already - case $facts['os']['family'] { + case $facts['os']['name'] { 'Debian': { include ::php::repo::debian } diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb new file mode 100644 index 00000000..f10ad8c0 --- /dev/null +++ b/spec/classes/php_repo_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +describe 'php::repo', type: :class do + on_supported_os.each do |os, facts| + context "on #{os}" do + let :facts do + facts + end + + describe 'when configuring a package repo' do + case facts[:osfamily] + when 'Debian' + case facts[:operatingsystem] + when 'Debian' + it { is_expected.to contain_class('php::repo::debian') } + when 'Ubuntu' + it { is_expected.to contain_class('php::repo::ubuntu') } + end + when 'Suse' + it { is_expected.to contain_class('php::repo::suse') } + when 'RedHat' + it { is_expected.to contain_class('php::repo::redhat') } + end + end + + end + end +end From 3c598fb5a53567c90bddcc147cad1206bac338a6 Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Thu, 10 Aug 2017 13:03:06 -0500 Subject: [PATCH 2/2] Fix Rubocop EmptyLinesAroundBlockBody error --- spec/classes/php_repo_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/classes/php_repo_spec.rb b/spec/classes/php_repo_spec.rb index f10ad8c0..79429fcc 100644 --- a/spec/classes/php_repo_spec.rb +++ b/spec/classes/php_repo_spec.rb @@ -22,7 +22,6 @@ it { is_expected.to contain_class('php::repo::redhat') } end end - end end end