Sha256: 6018ffda81cbefe2cf68c4bd42df652f13b434cb9f82c15e0d42dba27009c1ce

Contents?: true

Size: 993 Bytes

Versions: 10

Compression:

Stored size: 993 Bytes

Contents

#!/usr/bin/env ruby

Dir.chdir(File.dirname(__FILE__)) { (s = lambda { |f| File.exist?(f) ? require(f) : Dir.chdir("..") { s.call(f) } }).call("spec/spec_helper.rb") }

require 'puppet/reports'
require 'time'

processor = Puppet::Reports.report(:store)

describe processor do
  describe "#process" do
    include PuppetSpec::Files
    before :each do
      Puppet[:reportdir] = tmpdir('reports') << '/reports' 
      @report = YAML.load_file(File.join(PuppetSpec::FIXTURE_DIR, 'yaml/report2.6.x.yaml')).extend processor
    end

    it "should create a report directory for the client if one doesn't exist" do
      @report.process

      File.should be_directory(File.join(Puppet[:reportdir], @report.host))
    end

    it "should write the report to the file in YAML" do
      Time.stubs(:now).returns(Time.parse("2011-01-06 12:00:00 UTC"))
      @report.process

      File.read(File.join(Puppet[:reportdir], @report.host, "201101061200.yaml")).should == @report.to_yaml
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
puppet-2.6.16 spec/unit/reports/store_spec.rb
puppet-2.6.15 spec/unit/reports/store_spec.rb
puppet-2.6.14 spec/unit/reports/store_spec.rb
puppet-2.6.13 spec/unit/reports/store_spec.rb
puppet-2.6.12 spec/unit/reports/store_spec.rb
puppet-2.6.11 spec/unit/reports/store_spec.rb
puppet-2.6.10 spec/unit/reports/store_spec.rb
puppet-2.6.9 spec/unit/reports/store_spec.rb
puppet-2.6.8 spec/unit/reports/store_spec.rb
puppet-2.6.7 spec/unit/reports/store_spec.rb