Sha256: 65f0d7083197cfec21bdd327c9adcccb9973176fbced8684ea1edcc4b4d48933

Contents?: true

Size: 1017 Bytes

Versions: 10

Compression:

Stored size: 1017 Bytes

Contents

require 'test_helper'

class PlaybookRunnerTest < ActiveSupport::TestCase
  context 'roles dir' do
    test 'reads default when none provided' do
      File.expects(:exist?).with('/etc/ansible').returns(true)
      runner = ForemanAnsibleCore::PlaybookRunner.new(nil, nil)
      assert '/etc/ansible', runner.instance_variable_get('@ansible_dir')
    end
  end

  context 'working_dir' do
    test 'creates temp one if not provided' do
      Dir.expects(:mktmpdir)
      File.expects(:exist?).with('/etc/ansible').returns(true)
      ForemanAnsibleCore::PlaybookRunner.new(nil, nil)
    end

    test 'reads it when provided' do
      settings = { :working_dir => '/foo', :ansible_dir => '/etc/foo' }
      ForemanAnsibleCore.expects(:settings).returns(settings)
      File.expects(:exist?).with(settings[:ansible_dir]).returns(true)
      Dir.expects(:mktmpdir).never
      runner = ForemanAnsibleCore::PlaybookRunner.new(nil, nil)
      assert '/foo', runner.instance_variable_get('@working_dir')
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_ansible-1.4.5 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.4.3 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.4.2 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.4.1 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.4.0 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.3.1 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.3.0 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.2.1 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.2 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb
foreman_ansible-1.1 test/unit/lib/foreman_ansible_core/playbook_runner_test.rb