Sha256: 37c1c34494758a4d3ca04d050ca13a70fe86548e463b1d7c53aa1e22dda52111

Contents?: true

Size: 1.71 KB

Versions: 15

Compression:

Stored size: 1.71 KB

Contents

require 'spec_helper'

describe 'Utilities::Module' do
  before :each do
    clean_up_module_dir(@path)
    @opts = { :module_path => @path, :enable_beaker_tests => false,
              :enable_user_templates => false, :template_dir => nil }
    @module = Utilities::PuppetModule.instance
    @module.module_path = @opts[:module_path]
  end

  before :all do
    # enabling the removal of real modules slows down tests, but from time to time we may need to
    FileUtils.rm_rf(fixture_modules_path) if ENV['RETROSPEC_CLEAN_UP_TEST_MODULES'] =~ /true/
    install_module('puppetlabs-tomcat')
    @path = File.join(fixture_modules_path, 'tomcat')
  end

  it 'should create an instance' do
    expect(@module).to be_instance_of(Utilities::PuppetModule)
  end

  it 'should create tmp module path' do
    expect(File.exist?(@module.tmp_modules_dir)).to be true
  end

  it 'should create a temp modules dir' do
    tomcat_path = Utilities::PuppetModule.create_tmp_module_path
    expect(tomcat_path).to match(/modules/)
  end

  it 'should create a temp modules dir' do
    tomcat_path = @module.create_tmp_module_path(@opts[:module_path])
    expect(tomcat_path).to match(/modules/)
    expect(File.exist?(tomcat_path)).to be true
  end

  it 'should set the module path' do
    expect(@module.module_path).to eq(@opts[:module_path])
  end

  it 'should create a link in the temp modules directory' do
    tmp_path = @module.create_tmp_module_path(@opts[:module_path])
    expect(File.exist?(tmp_path)).to eq(true)
    expect(tmp_path).to eq(File.join(@module.tmp_modules_dir, @module.module_name))
  end

  it 'should find types' do
    expect(@module.types).to be_instance_of(Array)
    expect(@module.types.map(&:name).length).to eq(18)
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
puppet-retrospec-1.8.0 spec/unit/module_spec.rb
puppet-retrospec-1.7.0 spec/unit/module_spec.rb
puppet-retrospec-1.6.1 spec/unit/module_spec.rb
puppet-retrospec-1.6.0 spec/unit/module_spec.rb
puppet-retrospec-1.5.0 spec/unit/module_spec.rb
puppet-retrospec-1.4.1 spec/unit/module_spec.rb
puppet-retrospec-1.4.0 spec/unit/module_spec.rb
puppet-retrospec-1.3.2 spec/unit/module_spec.rb
puppet-retrospec-1.3.1 spec/unit/module_spec.rb
puppet-retrospec-1.3.0 spec/unit/module_spec.rb
puppet-retrospec-1.2.1 spec/unit/module_spec.rb
puppet-retrospec-1.2.0 spec/unit/module_spec.rb
puppet-retrospec-1.1.0 spec/unit/module_spec.rb
puppet-retrospec-1.0.0 spec/unit/module_spec.rb
puppet-retrospec-0.12.2 spec/unit/module_spec.rb