Sha256: 46917a68d958f7990dec16aac3a6bb53aa391b4b2d8d739145cb3f9957e2afbe

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
require 'chake/node'
require 'chake/config_manager/itamae_remote'

describe Chake::ConfigManager::ItamaeRemote do
  let(:node) do
    Chake::Node.new('somehost').tap do |n|
      n.silent = true
      n.data['itamae-remote'] = ['foo.rb', 'bar.rb']
    end
  end
  let(:cfg) { Chake::ConfigManager.get(node) }

  it 'is detected correctly' do
    expect(cfg).to be_a(Chake::ConfigManager::ItamaeRemote)
  end

  it 'requires uploading' do
    expect(cfg.needs_upload?).to eq(true)
  end

  it 'calls itamae remotely to converge' do
    expect(node).to receive(:run_as_root).with(
      a_string_matching(%r{itamae.*#{node.path}/foo.rb.*#{node.path}/bar.rb})
    )
    cfg.converge
  end

  it 'calls itamae remotely to apply' do
    expect(node).to receive(:run_as_root).with(
      a_string_matching(%r{itamae.*#{node.path}/doit.rb})
    )
    cfg.apply('doit.rb')
  end

  it 'handles silent mode' do
    node.silent = true
    expect(node).to receive(:run_as_root).with(
      a_string_matching(/--log-level\\=warn/)
    )
    cfg.converge
  end

  it 'has a name with dashes' do
    expect(cfg.name).to eq('itamae-remote')
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chake-0.91 spec/chake/config_manager/itamae_remote_spec.rb
chake-0.90.3 spec/chake/config_manager/itamae_remote_spec.rb
chake-0.90.2 spec/chake/config_manager/itamae_remote_spec.rb
chake-0.90.1 spec/chake/config_manager/itamae_remote_spec.rb
chake-0.90 spec/chake/config_manager/itamae_remote_spec.rb