diff --git a/.travis.yml b/.travis.yml index 46424bf..a1f4ec3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,26 +6,26 @@ rvm: - 2.0.0 - 2.1.5 env: - - PUPPET_VERSION=3.5 - - PUPPET_VERSION=3.5 FUTURE_PARSER=yes - - PUPPET_VERSION=4.0 + - PUPPET_VERSION=3.5 ONLY_OS=redhat-6-x86_64,centos-6-x86_64,redhat-7-x86_64,centos-7-x86_64 + - PUPPET_VERSION=3.5 FUTURE_PARSER=yes ONLY_OS=redhat-6-x86_64,centos-6-x86_64,redhat-7-x86_64,centos-7-x86_64 + - PUPPET_VERSION=4.0 ONLY_OS=redhat-6-x86_64,centos-6-x86_64,redhat-7-x86_64,centos-7-x86_64 matrix: fast_finish: true exclude: # No support for Ruby 1.9.3 on Puppet 4.x - rvm: 1.9.3 - env: PUPPET_VERSION=4.0 + env: PUPPET_VERSION=4.0 ONLY_OS=redhat-6-x86_64,centos-6-x86_64,redhat-7-x86_64,centos-7-x86_64 include: # Only platforms left to support ruby 1.8.7 - rvm: 1.8.7 - env: PUPPET_VERSION=3.5 + env: PUPPET_VERSION=3.5 ONLY_OS=redhat-6-x86_64,centos-6-x86_64,redhat-7-x86_64,centos-7-x86_64 - rvm: 1.8.7 env: PUPPET_VERSION=3.5 FUTURE_PARSER=yes # Only Puppet 4.x supports Ruby 2.2. Also limit the OS set we test Ruby 2.2 with. - rvm: 2.2.3 - env: PUPPET_VERSION=4.0 + env: PUPPET_VERSION=4.0 ONLY_OS=redhat-6-x86_64,centos-6-x86_64,redhat-7-x86_64,centos-7-x86_64 # Only Puppet >= 4.4 supports Ruby 2.3. Also limit the OS set we test Ruby 2.3 with. - rvm: 2.3.0 - env: PUPPET_VERSION=4.4 + env: PUPPET_VERSION=4.4 ONLY_OS=redhat-6-x86_64,centos-6-x86_64,redhat-7-x86_64,centos-7-x86_64 bundler_args: --without development sudo: false diff --git a/Gemfile b/Gemfile index 5eb6ea2..80dc9e7 100644 --- a/Gemfile +++ b/Gemfile @@ -8,11 +8,9 @@ gem 'puppet', ENV.key?('PUPPET_VERSION') ? "~> #{ENV['PUPPET_VERSION']}" : '~> 3 if RUBY_VERSION.start_with? '1.8' gem 'rake', '< 11' gem 'rspec', '>= 3', '< 3.2' - gem 'rspec-puppet-facts', '< 1.4.0' else gem 'rake' gem 'rspec', '~> 3.0' - gem 'rspec-puppet-facts', '>= 1.5' end gem 'rspec-puppet', '~> 2.3' gem 'puppetlabs_spec_helper', '>= 0.8.0' @@ -34,5 +32,6 @@ gem 'mime-types', '~> 1.0', {"platforms"=>["ruby_18"], "groups"=>["development"] gem 'json', '~> 1.0', {"platforms"=>["ruby_18", "ruby_19"], "groups"=>["test"]} gem 'json_pure', '~> 1.0', {"platforms"=>["ruby_18", "ruby_19"], "groups"=>["test"]} gem 'metadata-json-lint' +gem 'rspec-puppet-facts', '>= 1.7' # vim:ft=ruby diff --git a/spec/classes/crane_config_spec.rb b/spec/classes/crane_config_spec.rb index 1c289bc..43e91ab 100644 --- a/spec/classes/crane_config_spec.rb +++ b/spec/classes/crane_config_spec.rb @@ -3,19 +3,13 @@ describe 'crane' do on_supported_os.each do |os, facts| context "os #{os}" do - let :default_facts do - facts.merge(:concat_basedir => '/tmp') - end + let(:facts) { facts } context 'with no parameters' do let :pre_condition do "class {'crane':}" end - let :facts do - default_facts - end - it "should set up the config file" do should contain_file('/etc/crane.conf'). with({ @@ -35,10 +29,6 @@ }" end - let :facts do - default_facts - end - it "should set the port" do should contain_file('/etc/crane.conf'). with_content(/^endpoint: foo.example.com:5001$/) @@ -52,10 +42,6 @@ }" end - let :facts do - default_facts - end - it "should set the data_dir" do should contain_file('/etc/crane.conf'). with_content(/^data_dir: foo$/) diff --git a/spec/classes/crane_spec.rb b/spec/classes/crane_spec.rb index 12a2ef2..f001a2c 100644 --- a/spec/classes/crane_spec.rb +++ b/spec/classes/crane_spec.rb @@ -3,9 +3,7 @@ describe 'crane' do on_supported_os.each do |os, facts| context "on #{os}" do - let :facts do - facts.merge(:concat_basedir => '/tmp') - end + let(:facts) { facts } it { should contain_class('crane::install') } it { should contain_class('crane::config') } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3e7f4ec..2901dde 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,6 +6,11 @@ require 'rspec-puppet-facts' include RspecPuppetFacts +add_custom_fact :concat_basedir, '/tmp' +add_custom_fact :mongodb_version, '2.4.14' +add_custom_fact :root_home, '/root' +add_custom_fact :puppetversion, Puppet.version + # Workaround for no method in rspec-puppet to pass undef through :params class Undef def inspect; 'undef'; end