From 520b5e876c5a31b9f4bf38a3714a125316833dd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Can=C3=A9vet?= Date: Mon, 22 Dec 2014 18:34:19 +0100 Subject: Fix unit tests when using future parser --- spec/hosts/simple_debian_squeeze_spec.rb | 117 ------------------------------- spec/hosts/simple_debian_wheezy_spec.rb | 108 ---------------------------- spec/hosts/simple_redhat_spec.rb | 99 -------------------------- spec/hosts/with_lens_noaugeas_spec.rb | 9 --- spec/hosts/with_lens_spec.rb | 66 ----------------- spec/hosts/wrong_os_spec.rb | 15 ---- 6 files changed, 414 deletions(-) delete mode 100644 spec/hosts/simple_debian_squeeze_spec.rb delete mode 100644 spec/hosts/simple_debian_wheezy_spec.rb delete mode 100644 spec/hosts/simple_redhat_spec.rb delete mode 100644 spec/hosts/with_lens_noaugeas_spec.rb delete mode 100644 spec/hosts/with_lens_spec.rb delete mode 100644 spec/hosts/wrong_os_spec.rb (limited to 'spec/hosts') diff --git a/spec/hosts/simple_debian_squeeze_spec.rb b/spec/hosts/simple_debian_squeeze_spec.rb deleted file mode 100644 index 18bc50c..0000000 --- a/spec/hosts/simple_debian_squeeze_spec.rb +++ /dev/null @@ -1,117 +0,0 @@ -require 'spec_helper' - -describe 'simple_debian_squeeze' do - let (:facts) { { - :augeas_lens_dir => :undef, - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - } } - - context 'when versions are not specified' do - let (:facts) { { - :augeas_lens_dir => :undef, - :augeas_version => :undef, - :augeas_ruby_version => :undef, - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :rubyversion => '1.8.7', - } } - - it { is_expected.to contain_package('libaugeas0').with( - :ensure => 'present' - ) } - it { is_expected.to contain_package('augeas-tools').with( - :ensure => 'present' - ) } - it { is_expected.to contain_package('augeas-lenses').with( - :ensure => 'present' - ) } - it { is_expected.to contain_package('ruby-augeas').with( - :ensure => 'present', - :name => 'libaugeas-ruby1.8' - ) } - end - - context 'when versions are specified' do - let (:facts) { { - :osfamily => 'Debian', - :lsbdistcodename => 'squeeze', - :augeas_lens_dir => :undef, - :augeas_version => '1.2.3', - :augeas_ruby_version => '3.2.1', - :rubyversion => '1.8.7', - } } - - it { is_expected.to contain_package('libaugeas0').with( - :ensure => '1.2.3' - ) } - it { is_expected.to contain_package('augeas-tools').with( - :ensure => '1.2.3' - ) } - it { is_expected.to contain_package('augeas-lenses').with( - :ensure => '1.2.3' - ) } - it { is_expected.to contain_package('ruby-augeas').with( - :ensure => '3.2.1', - :name => 'libaugeas-ruby1.8' - ) } - end - - context 'with standard lens_dir' do - let (:facts) { { - :augeas_lens_dir => :undef, - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :rubyversion => '1.8.7', - } } - - it { is_expected.to contain_file('/usr/share/augeas/lenses').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true', - :recurse => 'true', - :recurselimit => 1 - ) } - it { is_expected.to contain_file('/usr/share/augeas/lenses/dist').with( - :ensure => 'directory', - :purge => 'false' - ) } - it { is_expected.to contain_file('/usr/share/augeas/lenses/tests').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true' - ).without(:recurse) } - end - - context 'with a non standard lens_dir' do - let (:facts) { { - :augeas_lens_dir => '/opt/augeas/lenses', - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :rubyversion => '1.8.7', - } } - - it { is_expected.to contain_file('/opt/augeas/lenses').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true', - :recurse => 'true', - :recurselimit => 1 - ) } - it { is_expected.to contain_file('/opt/augeas/lenses/dist').with( - :ensure => 'directory', - :purge => 'false' - ) } - it { is_expected.to contain_file('/opt/augeas/lenses/tests').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true' - ).without(:recurse) } - end -end diff --git a/spec/hosts/simple_debian_wheezy_spec.rb b/spec/hosts/simple_debian_wheezy_spec.rb deleted file mode 100644 index 3e20db0..0000000 --- a/spec/hosts/simple_debian_wheezy_spec.rb +++ /dev/null @@ -1,108 +0,0 @@ -require 'spec_helper' - -describe 'simple_debian_wheezy' do - let (:facts) { { - :augeas_lens_dir => :undef, - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :lsbdistcodename => 'wheezy', - :osfamily => 'Debian', - :rubyversion => '1.9.1', - } } - - context 'when versions are not specified' do - it { is_expected.to contain_package('libaugeas0').with( - :ensure => 'present' - ) } - it { is_expected.to contain_package('augeas-tools').with( - :ensure => 'present' - ) } - it { is_expected.to contain_package('augeas-lenses').with( - :ensure => 'present' - ) } - it { is_expected.to contain_package('ruby-augeas').with( - :ensure => 'present', - :name => 'libaugeas-ruby1.9.1' - ) } - end - - context 'when versions are specified' do - let (:facts) { { - :osfamily => 'Debian', - :lsbdistcodename => 'wheezy', - :rubyversion => '1.9.1', - :augeas_lens_dir => :undef, - :augeas_version => '1.2.3', - :augeas_ruby_version => '3.2.1', - } } - - it { is_expected.to contain_package('libaugeas0').with( - :ensure => '1.2.3' - ) } - it { is_expected.to contain_package('augeas-tools').with( - :ensure => '1.2.3' - ) } - it { is_expected.to contain_package('augeas-lenses').with( - :ensure => '1.2.3' - ) } - it { is_expected.to contain_package('ruby-augeas').with( - :ensure => '3.2.1', - :name => 'libaugeas-ruby1.9.1' - ) } - end - - context 'with standard lens_dir' do - let (:facts) { { - :augeas_lens_dir => :undef, - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :osfamily => 'Debian', - :rubyversion => '1.9.1', - } } - - it { is_expected.to contain_file('/usr/share/augeas/lenses').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true', - :recurse => 'true', - :recurselimit => 1 - ) } - it { is_expected.to contain_file('/usr/share/augeas/lenses/dist').with( - :ensure => 'directory', - :purge => 'false' - ) } - it { is_expected.to contain_file('/usr/share/augeas/lenses/tests').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true' - ).without(:recurse) } - end - - context 'with a non standard lens_dir' do - let (:facts) { { - :augeas_lens_dir => '/opt/augeas/lenses', - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :lsbdistcodename => 'wheezy', - :osfamily => 'Debian', - :rubyversion => '1.9.1', - } } - - it { is_expected.to contain_file('/opt/augeas/lenses').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true', - :recurse => 'true', - :recurselimit => 1 - ) } - it { is_expected.to contain_file('/opt/augeas/lenses/dist').with( - :ensure => 'directory', - :purge => 'false' - ) } - it { is_expected.to contain_file('/opt/augeas/lenses/tests').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true' - ).without(:recurse) } - end -end diff --git a/spec/hosts/simple_redhat_spec.rb b/spec/hosts/simple_redhat_spec.rb deleted file mode 100644 index 42c17c8..0000000 --- a/spec/hosts/simple_redhat_spec.rb +++ /dev/null @@ -1,99 +0,0 @@ -require 'spec_helper' - -describe 'simple_redhat' do - let (:facts) { { - :osfamily => 'RedHat', - } } - - context 'when versions are not specified' do - let (:facts) { { - :augeas_lens_dir => :undef, - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :osfamily => 'RedHat', - } } - - it { is_expected.to contain_package('augeas').with( - :ensure => 'present' - ) } - it { is_expected.to contain_package('augeas-libs').with( - :ensure => 'present' - ) } - it { is_expected.to contain_package('ruby-augeas').with( - :ensure => 'present', - :name => 'ruby-augeas' - ) } - end - - context 'when versions are specified' do - let (:facts) { { - :osfamily => 'RedHat', - :augeas_lens_dir => :undef, - :augeas_version => '1.2.3', - :augeas_ruby_version => '3.2.1', - } } - - it { is_expected.to contain_package('augeas').with( - :ensure => '1.2.3' - ) } - it { is_expected.to contain_package('augeas-libs').with( - :ensure => '1.2.3' - ) } - it { is_expected.to contain_package('ruby-augeas').with( - :ensure => '3.2.1', - :name => 'ruby-augeas' - ) } - end - - context 'with standard lens_dir' do - let (:facts) { { - :augeas_lens_dir => :undef, - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :osfamily => 'RedHat', - } } - - it { is_expected.to contain_file('/usr/share/augeas/lenses').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true', - :recurse => 'true', - :recurselimit => 1 - ) } - it { is_expected.to contain_file('/usr/share/augeas/lenses/dist').with( - :ensure => 'directory', - :purge => 'false' - ) } - it { is_expected.to contain_file('/usr/share/augeas/lenses/tests').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true' - ).without(:recurse) } - end - - context 'with a non standard lens_dir' do - let (:facts) { { - :augeas_lens_dir => '/opt/augeas/lenses', - :augeas_ruby_version => :undef, - :augeas_version => :undef, - :osfamily => 'RedHat', - } } - - it { is_expected.to contain_file('/opt/augeas/lenses').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true', - :recurse => 'true', - :recurselimit => 1 - ) } - it { is_expected.to contain_file('/opt/augeas/lenses/dist').with( - :ensure => 'directory', - :purge => 'false' - ) } - it { is_expected.to contain_file('/opt/augeas/lenses/tests').with( - :ensure => 'directory', - :purge => 'true', - :force => 'true' - ).without(:recurse) } - end -end diff --git a/spec/hosts/with_lens_noaugeas_spec.rb b/spec/hosts/with_lens_noaugeas_spec.rb deleted file mode 100644 index 7786918..0000000 --- a/spec/hosts/with_lens_noaugeas_spec.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'spec_helper' - -describe 'with_lens_noaugeas' do - it 'should error' do - expect { - is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') - }.to raise_error(Puppet::Error, /You must declare the augeas class/) - end -end diff --git a/spec/hosts/with_lens_spec.rb b/spec/hosts/with_lens_spec.rb deleted file mode 100644 index e0f5dff..0000000 --- a/spec/hosts/with_lens_spec.rb +++ /dev/null @@ -1,66 +0,0 @@ -require 'spec_helper' - -describe 'with_lens' do - let (:facts) { { - :osfamily => 'RedHat', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } } - - context 'when lens_source is passed' do - let (:facts) { { - :osfamily => 'RedHat', - :augeas_lens_source => '/tmp/foo.aug', - :augeas_stock_since => :undef, - :augeas_test_source => :undef, - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } } - - it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') } - it { is_expected.to contain_exec('Typecheck lens foo') } - it { is_expected.not_to contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') } - it { is_expected.not_to contain_exec('Test lens foo') } - end - - context 'when lens_source and test_source are passed' do - let (:facts) { { - :osfamily => 'RedHat', - :augeas_lens_source => '/tmp/foo.aug', - :augeas_test_source => '/tmp/test_foo.aug', - :augeas_stock_since => :undef, - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } } - - it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') } - it { is_expected.to contain_exec('Typecheck lens foo') } - it { is_expected.to contain_file('/usr/share/augeas/lenses/tests/test_foo.aug') } - it { is_expected.to contain_exec('Test lens foo') } - end - - context 'when stock_since is passed and augeas is older' do - let (:facts) { { - :osfamily => 'RedHat', - :augeas_lens_source => '/tmp/foo.aug', - :augeas_stock_since => '1.2.3', - :augeasversion => '1.0.0', - :augeas_test_source => :undef, - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } } - - it { is_expected.to contain_file('/usr/share/augeas/lenses/foo.aug') } - it { is_expected.to contain_exec('Typecheck lens foo') } - end - - context 'when stock_since is passed and augeas is newer' do - let (:facts) { { - :osfamily => 'RedHat', - :augeas_lens_source => '/tmp/foo.aug', - :augeas_stock_since => '1.2.3', - :augeasversion => '1.5.0', - :augeas_test_source => :undef, - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - } } - - it { is_expected.not_to contain_file('/usr/share/augeas/lenses/foo.aug') } - it { is_expected.not_to contain_exec('Typecheck lens foo') } - end -end diff --git a/spec/hosts/wrong_os_spec.rb b/spec/hosts/wrong_os_spec.rb deleted file mode 100644 index 98fb93f..0000000 --- a/spec/hosts/wrong_os_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'spec_helper' - -describe 'wrong_os' do - let (:facts) { { - :augeas_lens_dir => :undef, - :augeas_ruby_version => :undef, - :augeas_test_source => :undef, - :augeas_version => :undef, - :osfamily => 'MS-DOS', - } } - - it 'should fail' do - expect { is_expected.to contain_package('ruby-augeas') }.to raise_error(Puppet::Error, /Unsupported OS family/) - end -end -- cgit v1.2.3