diff options
| author | Nick Lewis <nick@puppetlabs.com> | 2011-01-07 13:24:54 -0800 |
|---|---|---|
| committer | Nick Lewis <nick@puppetlabs.com> | 2011-01-07 13:24:54 -0800 |
| commit | 04289febd5575ab2bb6aa0b1a121905b09cf227a (patch) | |
| tree | 18eab2fab080c3bcbedd148c4e3145f058ff7ffc /spec | |
| parent | 0f0c70cae2e022d7614b8d847fa42bf95f5c3d0d (diff) | |
| parent | 8aa8b9dbc2437cea8109e4d272018437afe13794 (diff) | |
Merge branch 'ticket/2.6.next/5799' into next
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/unit/reports/store_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/unit/reports/store_spec.rb b/spec/unit/reports/store_spec.rb new file mode 100644 index 000000000..1acb5badd --- /dev/null +++ b/spec/unit/reports/store_spec.rb @@ -0,0 +1,31 @@ +#!/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') + @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 |
