Sha256: f050dd4da3cce9c54fa5f0fa0cbebb69b9a6a17d5530213553822e0b034cbd05

Contents?: true

Size: 1.61 KB

Versions: 9

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

describe 'rbenv::version' do
  let(:facts) {{
    :osfamily => 'Debian',
  }}

  context 'Version 1.2.3-p456' do
    let(:title) { '1.2.3-p456' }
    let(:exec_title) { 'install bundler for 1.2.3-p456' }
    let(:cmd_prefix) { /^\/usr\/bin\/env -uRUBYOPT -uBUNDLE_GEMFILE -uGEM_HOME -uGEM_PATH \/usr\/bin\/rbenv exec gem/ }

    context 'ruby version' do
      it {
        should contain_package('rbenv-ruby-1.2.3-p456').with(
          :notify  => "Exec[#{exec_title}]",
          :require => 'Class[Rbenv]'
        )
      }
    end

    context 'rehash' do
      it { should contain_rbenv__rehash('1.2.3-p456') }
      it { should contain_exec(exec_title).with_notify('Rbenv::Rehash[1.2.3-p456]') }
    end

    context 'bundler' do
      it 'should set env vars for rbenv' do
        should contain_exec(exec_title).with(
          :environment => [
            'RBENV_ROOT=/usr/lib/rbenv',
            'RBENV_VERSION=1.2.3-p456',
          ]
        )
      end

      context 'bundler_version not set (default)' do
        it {
          should contain_exec(exec_title).with(
            :command => /#{cmd_prefix} install bundler -v '>= 0'$/,
            :unless  => /#{cmd_prefix} query -i -n bundler -v '>= 0'$/
          )
        }
      end

      context 'bundler_version 8.9.0' do
        let(:params) {{
          :bundler_version => '8.9.0'
        }}

        it {
          should contain_exec(exec_title).with(
            :command => /#{cmd_prefix} install bundler -v '8.9.0'$/,
            :unless  => /#{cmd_prefix} query -i -n bundler -v '8.9.0'$/
          )
        }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
freighthop-0.2.1 modules/rbenv/spec/defines/rbenv__version_spec.rb
freighthop-0.2.0 modules/rbenv/spec/defines/rbenv__version_spec.rb
freighthop-0.1.0 modules/rbenv/spec/defines/rbenv__version_spec.rb
freighthop-0.0.6 modules/rbenv/spec/defines/rbenv__version_spec.rb
freighthop-0.0.5 modules/rbenv/spec/defines/rbenv__version_spec.rb
freighthop-0.0.4 modules/rbenv/spec/defines/rbenv__version_spec.rb
freighthop-0.0.3 modules/rbenv/spec/defines/rbenv__version_spec.rb
freighthop-0.0.2 modules/rbenv/spec/defines/rbenv__version_spec.rb
freighthop-0.0.1 modules/rbenv/spec/defines/rbenv__version_spec.rb