diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb new file mode 100644 index 0000000..c4e962e --- /dev/null +++ b/spec/classes/java_spec.rb @@ -0,0 +1,26 @@ +require 'spec_helper' + +describe 'java', :type => :class do + + context 'select openjdk for Centos 5.8' do + let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} } + it { should contain_package('java').with_name('java-1.7.0-openjdk') } + end + + context 'select openjdk for Centos 6.3' do + let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8'} } + it { should contain_package('java').with_name('java-1.7.0-openjdk') } + end + + context 'select default for Centos 5.3' do + let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} } + it { should contain_package('java').with_name('jdk') } + end + + context 'select passed value for Centos 5.3' do + let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} } + let(:params) { { 'distribution' => 'java-1.6.0-openjdk' } } + it { should contain_package('java').with_name('java-1.6.0-openjdk') } + end + +end diff --git a/spec/spec.opts b/spec/spec.opts deleted file mode 100644 index 91cd642..0000000 --- a/spec/spec.opts +++ /dev/null @@ -1,6 +0,0 @@ ---format -s ---colour ---loadby -mtime ---backtrace diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index a4aeeae..2c6f566 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,18 +1 @@ -require 'pathname' -dir = Pathname.new(__FILE__).parent -$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib') - -require 'mocha' -require 'puppet' -gem 'rspec', '=1.2.9' -require 'spec/autorun' - -Spec::Runner.configure do |config| - config.mock_with :mocha -end - -# We need this because the RAL uses 'should' as a method. This -# allows us the same behaviour but with a different method name. -class Object - alias :must :should -end +require 'puppetlabs_spec_helper/module_spec_helper'