diff options
| author | Paul Berry <paul@puppetlabs.com> | 2010-12-28 17:38:57 -0800 |
|---|---|---|
| committer | Paul Berry <paul@puppetlabs.com> | 2010-12-30 11:43:47 -0800 |
| commit | e596a570b2734ea27eec57a6e3a11843ccb47614 (patch) | |
| tree | bd1d1c39ea116e86b7ea1fd00591c46627d6947d /spec/unit | |
| parent | 908e0e09ed94ab6b74aba3b9e4fa95318d8894ef (diff) | |
| download | puppet-e596a570b2734ea27eec57a6e3a11843ccb47614.tar.gz puppet-e596a570b2734ea27eec57a6e3a11843ccb47614.tar.xz puppet-e596a570b2734ea27eec57a6e3a11843ccb47614.zip | |
(#5715) Removed Puppet::Util::Log#version.
This attribute was only relevant in reports, and in reports it was
redundant with Puppet::Transaction::Report#configuration_version and
Puppet::Transaction::Report#puppet_version.
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/parameter_spec.rb | 3 | ||||
| -rwxr-xr-x | spec/unit/resource/status_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/transaction/event_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/type_spec.rb | 2 | ||||
| -rwxr-xr-x | spec/unit/util/log_spec.rb | 31 | ||||
| -rwxr-xr-x | spec/unit/util/logging_spec.rb | 2 |
6 files changed, 24 insertions, 18 deletions
diff --git a/spec/unit/parameter_spec.rb b/spec/unit/parameter_spec.rb index 966bbfb81..f8ab05d62 100755 --- a/spec/unit/parameter_spec.rb +++ b/spec/unit/parameter_spec.rb @@ -52,8 +52,7 @@ describe Puppet::Parameter do @resource.expects(:line).returns 10 @resource.expects(:file).returns "file" @resource.expects(:tags).returns %w{one two} - @resource.expects(:version).returns 50 - @parameter.source_descriptors.should == {:tags=>["one", "two", "foo"], :path=>"//foo", :version=>50, :file => "file", :line => 10} + @parameter.source_descriptors.should == {:tags=>["one", "two", "foo"], :path=>"//foo", :file => "file", :line => 10} end describe "when returning the value" do diff --git a/spec/unit/resource/status_spec.rb b/spec/unit/resource/status_spec.rb index 945b8f613..08cb99b27 100755 --- a/spec/unit/resource/status_spec.rb +++ b/spec/unit/resource/status_spec.rb @@ -74,7 +74,7 @@ describe Puppet::Resource::Status do @status.send_log :notice, "my message" end - [:file, :line, :version].each do |attr| + [:file, :line].each do |attr| it "should pass the #{attr}" do Puppet::Util::Log.expects(:new).with { |args| args[attr] == "my val" } @status.send(attr.to_s + "=", "my val") diff --git a/spec/unit/transaction/event_spec.rb b/spec/unit/transaction/event_spec.rb index 0528402d8..f1db3835b 100755 --- a/spec/unit/transaction/event_spec.rb +++ b/spec/unit/transaction/event_spec.rb @@ -83,7 +83,7 @@ describe Puppet::Transaction::Event do Puppet::Transaction::Event.new(:tags => %w{one two}).send_log end - [:file, :line, :version].each do |attr| + [:file, :line].each do |attr| it "should pass the #{attr}" do Puppet::Util::Log.expects(:new).with { |args| args[attr] == "my val" } Puppet::Transaction::Event.new(attr => "my val").send_log diff --git a/spec/unit/type_spec.rb b/spec/unit/type_spec.rb index 48b00ec4a..7416064a5 100755 --- a/spec/unit/type_spec.rb +++ b/spec/unit/type_spec.rb @@ -116,7 +116,7 @@ describe Puppet::Type do catalog.version = 50 catalog.add_resource resource - resource.source_descriptors.should == {:version=>50, :tags=>["mount", "foo"], :path=>"/Mount[foo]"} + resource.source_descriptors.should == {:tags=>["mount", "foo"], :path=>"/Mount[foo]"} end it "should consider its type to be the name of its class" do diff --git a/spec/unit/util/log_spec.rb b/spec/unit/util/log_spec.rb index 7d96fe190..f3fd1b051 100755 --- a/spec/unit/util/log_spec.rb +++ b/spec/unit/util/log_spec.rb @@ -120,7 +120,7 @@ describe Puppet::Util::Log do Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => "foo") end - [:file, :line, :version].each do |attr| + [:file, :line].each do |attr| it "should use #{attr} if provided" do Puppet::Util::Log.any_instance.expects(attr.to_s + "=").with "foo" Puppet::Util::Log.new(:level => "notice", :message => :foo, attr => "foo") @@ -177,23 +177,12 @@ describe Puppet::Util::Log do log = Puppet::Util::Log.new(:level => "notice", :message => :foo) log.expects(:tag).with("tag") log.expects(:tag).with("tag2") - log.expects(:version=).with(100) log.source = source log.source.should == "path" end - it "should copy over any version information" do - catalog = Puppet::Resource::Catalog.new - catalog.version = 25 - source = Puppet::Type.type(:file).new :path => "/foo/bar" - catalog.add_resource source - - log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => source) - log.version.should == 25 - end - it "should copy over any file and line information" do source = Puppet::Type.type(:file).new :path => "/foo/bar" source.file = "/my/file" @@ -212,4 +201,22 @@ describe Puppet::Util::Log do end end end + + describe "to_yaml" do + it "should not include the @version attribute" do + log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :version => 100) + log.to_yaml_properties.should_not include('@version') + end + + it "should include attributes @level, @message, @source, @tags, and @time" do + log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :version => 100) + log.to_yaml_properties.should == %w{@level @message @source @tags @time} + end + + it "should include attributes @file and @line if specified" do + log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :file => "foo", :line => 35) + log.to_yaml_properties.should include('@file') + log.to_yaml_properties.should include('@line') + end + end end diff --git a/spec/unit/util/logging_spec.rb b/spec/unit/util/logging_spec.rb index 46ae5386f..411cd17a9 100755 --- a/spec/unit/util/logging_spec.rb +++ b/spec/unit/util/logging_spec.rb @@ -81,7 +81,7 @@ describe Puppet::Util::Logging do @logger.notice ["foo", "bar", "baz"] end - [:file, :line, :version, :tags].each do |attr| + [:file, :line, :tags].each do |attr| it "should include #{attr} if available" do @logger.singleton_class.send(:attr_accessor, attr) |
