Sha256: 510d72113ab00de8a639bd054ac7143913baeb983322502dc1e03c5852c7e6b2

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

require_relative '../../spec_helper'
require 'vagrant-adam/action/pre_provision_script'

describe VagrantPlugins::Adam::Action::PreProvisionScript do
  let(:app) { lambda { |_env| } }
  let(:env) { { machine: machine, tmp_path: ['/vagrant/'], ui: ui } }
  let(:ui) do
    double('ui').tap { |_ui| machine.stub(config: config, communicate: communicate, info: info) }
  end
  let(:info) { double('info') }
  let(:vm) { true }
  let(:machine) do
    double('machine').tap { |machine| machine.stub(config: config, communicate: communicate) }
  end
  let(:communicate) do
    double('communicate').tap { |machine| machine.stub(upload: upload) }
  end
  let(:upload) do
    double('upload')
  end
  let(:config) do
    double('config').tap { |config| config.stub(adam: adam, vm: vm) }
  end
  let(:vm) do
    double('vm').tap { |config| config.stub(guest: 'guest') }
  end
  let(:adam) do
    double('adam').tap { |config| config.stub(:finalize! => true, :provision_url => '/tmp/config.sh') }
  end

  describe '#initialize' do
    subject { described_class.new(app, env) }
    it { should be_a described_class }
  end

  describe '#call' do
    context 'when called' do
      subject(:pre_provision_script) { described_class.new(app, env) }
      it 'should fetch the script, then run it' do
        pre_provision_script.should_receive(:fetch_or_create_pre_provision_script).with(env)
        pre_provision_script.should_receive(:run_provision_script).with(env)
        pre_provision_script.call(env)
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-adam-0.3.0a spec/unit/vagrant-puppet-install/action/pre_provision_script_spec.rb
vagrant-adam-0.2.0a spec/unit/vagrant-puppet-install/action/pre_provision_script_spec.rb
vagrant-adam-0.1.0a spec/unit/vagrant-puppet-install/action/pre_provision_script_spec.rb