Sha256: 2a877a526eff0d868afdd39b9d554bbd1188c7986d290c15c07b11f391adcd6d

Contents?: true

Size: 1.82 KB

Versions: 39

Compression:

Stored size: 1.82 KB

Contents

#! /usr/bin/env ruby
require 'spec_helper'
require 'puppet_spec/files'
require 'puppet/application/doc'

describe Puppet::Application::Doc do
  include PuppetSpec::Files

  it "should not generate an error when module dir overlaps parent of site.pp (#4798)",
     :if => (Puppet.features.rdoc1? and not Puppet.features.microsoft_windows?) do
    begin
      # Note: the directory structure below is more complex than it
      # needs to be, but it's representative of the directory structure
      # used in bug #4798.
      old_dir = Dir.getwd # Note: can't use chdir with a block because it will generate bogus warnings
      tmpdir = tmpfile('doc_spec')
      Dir.mkdir(tmpdir)
      Dir.chdir(tmpdir)
      site_file = 'site.pp'
      File.open(site_file, 'w') do |f|
        f.puts '# A comment'
      end
      modules_dir = 'modules'
      Dir.mkdir(modules_dir)
      rt_dir = File.join(modules_dir, 'rt')
      Dir.mkdir(rt_dir)
      manifests_dir = File.join(rt_dir, 'manifests')
      Dir.mkdir(manifests_dir)
      rt_file = File.join(manifests_dir, 'rt.pp')
      File.open(rt_file, 'w') do |f|
        f.puts '# A class'
        f.puts 'class foo { }'
        f.puts '# A definition'
        f.puts 'define bar { }'
      end

      puppet = Puppet::Application[:doc]
      puppet.options[:mode] = :rdoc

      env = Puppet::Node::Environment.create(:rdoc, [modules_dir], site_file) 
      Puppet.override(:current_environment =>  env) do
        expect { puppet.run_command }.to exit_with 0
      end

      Puppet::FileSystem.exist?('doc').should be_true
    ensure
      Dir.chdir(old_dir)
    end
  end

  it "should respect the -o option" do
    puppetdoc = Puppet::Application[:doc]
    puppetdoc.command_line.stubs(:args).returns(['foo', '-o', 'bar'])
    puppetdoc.parse_options
    puppetdoc.options[:outputdir].should == 'bar'
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
puppet-3.8.7 spec/integration/application/doc_spec.rb
puppet-3.8.7-x86-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.7-x64-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.6 spec/integration/application/doc_spec.rb
puppet-3.8.6-x86-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.6-x64-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.5 spec/integration/application/doc_spec.rb
puppet-3.8.5-x86-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.5-x64-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.4 spec/integration/application/doc_spec.rb
puppet-3.8.4-x86-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.4-x64-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.3 spec/integration/application/doc_spec.rb
puppet-3.8.3-x86-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.3-x64-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.2 spec/integration/application/doc_spec.rb
puppet-3.8.2-x86-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.2-x64-mingw32 spec/integration/application/doc_spec.rb
puppet-3.8.1 spec/integration/application/doc_spec.rb
puppet-3.8.1-x86-mingw32 spec/integration/application/doc_spec.rb