Sha256: ca52232b4eb6a3e2f6ed641f4f8e87fe7d6ba5a1c3fac2975f7a6ea4f5ad617b

Contents?: true

Size: 1.69 KB

Versions: 64

Compression:

Stored size: 1.69 KB

Contents

require 'spec_helper'

require 'r10k/deployment'

shared_examples_for "a deploy action that requires a config file" do
  let(:config) do
    R10K::Deployment::MockConfig.new(
      :sources => {
        :control => {
          :type => :mock,
          :basedir => '/some/nonexistent/path/control',
          :environments => %w[first second third],
        },
        :hiera => {
          :type => :mock,
          :basedir => '/some/nonexistent/path/hiera',
          :environments => %w[fourth fifth sixth],
        }
      }
    )
  end

  let(:deployment) { R10K::Deployment.new(config) }

  before do
    allow(R10K::Deployment).to receive(:new).and_return(deployment)
  end

  it "exits when no config file was provided or found" do
    subject.instance_variable_set(:@config, nil)
    expect {
      subject.call
    }.to exit_with(8)
  end
end

shared_examples_for "a deploy action that can be write locked" do

  let(:config) do
    R10K::Deployment::MockConfig.new(
      :sources => {
        :control => {
          :type => :mock,
          :basedir => '/some/nonexistent/path/control',
          :environments => %w[first second third],
        },
        :hiera => {
          :type => :mock,
          :basedir => '/some/nonexistent/path/hiera',
          :environments => %w[fourth fifth sixth],
        }
      }
    )
  end

  let(:deployment) { R10K::Deployment.new(config) }

  before do
    allow(R10K::Deployment).to receive(:new).and_return(deployment)
    subject.settings = {deploy: {write_lock: "Disabled, yo"}}
  end

  it "exits without running when the write lock is set" do
    expect(subject).to_not receive(:visit_deployment)
    expect {
      subject.call
    }.to exit_with(16)
  end
end

Version data entries

64 entries across 64 versions & 2 rubygems

Version Path
r10k-3.15.0 spec/shared-examples/deploy-actions.rb
akerl-r10k-3.14.2.1 spec/shared-examples/deploy-actions.rb
r10k-3.14.2 spec/shared-examples/deploy-actions.rb
r10k-3.14.1 spec/shared-examples/deploy-actions.rb
r10k-3.14.0 spec/shared-examples/deploy-actions.rb
r10k-3.13.0 spec/shared-examples/deploy-actions.rb
r10k-3.12.1 spec/shared-examples/deploy-actions.rb
r10k-3.12.0 spec/shared-examples/deploy-actions.rb
r10k-3.11.0 spec/shared-examples/deploy-actions.rb
r10k-3.10.0 spec/shared-examples/deploy-actions.rb
r10k-3.9.3 spec/shared-examples/deploy-actions.rb
r10k-3.9.2 spec/shared-examples/deploy-actions.rb
r10k-3.9.1 spec/shared-examples/deploy-actions.rb
r10k-3.9.0 spec/shared-examples/deploy-actions.rb
r10k-3.8.0 spec/shared-examples/deploy-actions.rb
r10k-3.7.0 spec/shared-examples/deploy-actions.rb
r10k-3.6.0 spec/shared-examples/deploy-actions.rb
r10k-2.6.9 spec/shared-examples/deploy-actions.rb
r10k-3.5.2 spec/shared-examples/deploy-actions.rb
r10k-3.5.1 spec/shared-examples/deploy-actions.rb