Sha256: e0eb62fc5d8fc21aa7e080c94cf27498998c5542fc1c9afcee58dbe9ffdbd6f3

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

require 'rake/task'
require_relative '../spec_helper.rb'
require_relative '../../lib/puppet-check/tasks'

describe PuppetCheck::Tasks do
  context 'puppetcheck:spec' do
    let(:spec_tasks) { Rake::Task['puppetcheck:spec'.to_sym].invoke }

    it 'executes RSpec and RSpec-Puppet checks in the expected manner' do
      Dir.chdir(fixtures_dir)

      # rspec task executed
      expect { spec_tasks }.to output(/ruby.*rspec/).to_stdout
      # if this is first then the stdout is not captured for testing
      expect { spec_tasks }.not_to raise_exception
      # rspec-puppet setup executed
      expect(File.directory?('spec/fixtures/modules/fixtures')).to be true

      # cleanup rspec-puppet setup
      %w(Rakefile spec/spec_helper.rb).each { |file| File.delete(file) }
      %w(manifests modules).each { |dir| FileUtils.rm_r('spec/fixtures/' + dir) }
    end
  end

  context 'puppetcheck:beaker' do
    it 'verifies the Beaker task exists' do
      Dir.chdir(fixtures_dir)
      expect { Rake::Task['puppetcheck:spec'.to_sym].invoke }.not_to raise_exception
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-check-1.1.0 spec/puppet-check/tasks_spec.rb