Sha256: 5fd2624c53f649f56026e575c7f3dc84d7530d331083a41d00ab88f76a535b58

Contents?: true

Size: 1.51 KB

Versions: 20

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'
require 'r10k/source'

describe R10K::Source::Hash do

  describe '.valid_environments_hash?' do
    it "rejects strings" do
      expect(R10K::Source::Hash.valid_environments_hash?('200 OK'))
        .to eq false
    end
  end

  let(:environments_hash) do
    {
      'production' => {
        'remote'  => 'https://git.example.com/puppet/control-repo.git',
        'ref'     => 'release-141',
        'modules' => {
          'puppetlabs-stdlib' => '6.1.0',
          'puppetlabs-ntp' => '8.1.0',
          'example-myapp1' => {
            'git' => 'https://git.example.com/puppet/example-myapp1.git',
            'ref' => 'v1.3.0'
          }
        }
      },
      'development' => {
        'remote'  => 'https://git.example.com/puppet/control-repo.git',
        'ref'     => 'master',
        'modules' => {
          'puppetlabs-stdlib' => '6.1.0',
          'puppetlabs-ntp' => '8.1.0',
          'example-myapp1' => {
            'git' => 'https://git.example.com/puppet/example-myapp1.git',
            'ref' => 'v1.3.1'
          }
        }
      }
    }
  end

  describe "with a prefix" do
    subject do
      described_class.new('hashsource', '/some/nonexistent/dir',
                          prefix: 'prefixed', environments: environments_hash)
    end

    it "prepends environment names with a prefix" do
      environments = subject.environments
      expect(environments[0].dirname).to eq 'prefixed_production'
      expect(environments[1].dirname).to eq 'prefixed_development'
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
r10k-3.15.0 spec/unit/source/hash_spec.rb
akerl-r10k-3.14.2.1 spec/unit/source/hash_spec.rb
r10k-3.14.2 spec/unit/source/hash_spec.rb
r10k-3.14.1 spec/unit/source/hash_spec.rb
r10k-3.14.0 spec/unit/source/hash_spec.rb
r10k-3.13.0 spec/unit/source/hash_spec.rb
r10k-3.12.1 spec/unit/source/hash_spec.rb
r10k-3.12.0 spec/unit/source/hash_spec.rb
r10k-3.11.0 spec/unit/source/hash_spec.rb
r10k-3.10.0 spec/unit/source/hash_spec.rb
r10k-3.9.3 spec/unit/source/hash_spec.rb
r10k-3.9.2 spec/unit/source/hash_spec.rb
r10k-3.9.1 spec/unit/source/hash_spec.rb
r10k-3.9.0 spec/unit/source/hash_spec.rb
r10k-3.8.0 spec/unit/source/hash_spec.rb
r10k-3.7.0 spec/unit/source/hash_spec.rb
r10k-3.6.0 spec/unit/source/hash_spec.rb
r10k-3.5.2 spec/unit/source/hash_spec.rb
r10k-3.5.1 spec/unit/source/hash_spec.rb
r10k-3.5.0 spec/unit/source/hash_spec.rb