summaryrefslogtreecommitdiffstats
path: root/test/ral
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-06-25 14:04:13 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-06-25 18:14:58 -0700
commite5478d4ff0510e637ecec69f8b2fc7ef844ba5c0 (patch)
tree804e74f94879f0235bda032a548bccd4c6d40618 /test/ral
parent4ef40b88f246a6c158cc3ea91ea44dc941d4ac41 (diff)
downloadpuppet-e5478d4ff0510e637ecec69f8b2fc7ef844ba5c0.tar.gz
puppet-e5478d4ff0510e637ecec69f8b2fc7ef844ba5c0.tar.xz
puppet-e5478d4ff0510e637ecec69f8b2fc7ef844ba5c0.zip
Simplify the newattr method by removing a level violation
and update the specs that were testing it.
Diffstat (limited to 'test/ral')
-rwxr-xr-xtest/ral/manager/attributes.rb21
-rwxr-xr-xtest/ral/manager/type.rb2
2 files changed, 12 insertions, 11 deletions
diff --git a/test/ral/manager/attributes.rb b/test/ral/manager/attributes.rb
index cf8f2f9ae..5ddd27f97 100755
--- a/test/ral/manager/attributes.rb
+++ b/test/ral/manager/attributes.rb
@@ -115,12 +115,16 @@ class TestTypeAttributes < Test::Unit::TestCase
# Now set each of them
attr_check(type) do |inst, klass|
- inst.newattr(klass.name, :value => "value")
+ property = inst.newattr(klass.name)
+ property.value = "value"
+ property
end
# Now try it passing the class in
attr_check(type) do |inst, klass|
- inst.newattr(klass, :value => "value")
+ property = inst.newattr(klass)
+ property.value = "value"
+ property
end
# Lastly, make sure we can create and then set, separately
@@ -131,10 +135,9 @@ class TestTypeAttributes < Test::Unit::TestCase
end
# Make sure we can't create a new param object
- assert_raise(Puppet::Error,
- "Did not throw an error when replacing attr") do
- inst.newattr(klass.name, :value => "yay")
- end
+ new_attr = inst.newattr(klass.name)
+ assert_equal(new_attr, obj, "newattr should return the same object if called a second time")
+
obj
end
end
@@ -221,10 +224,7 @@ class TestTypeAttributes < Test::Unit::TestCase
end
yes.each { |a| assert(resource.should(a), "Did not get value for %s in %s" % [a, prov.name]) }
no.each do |a|
- assert_nil(resource.should(a), "Got value for unsupported %s in %s" % [a, prov.name])
- if Puppet::Util::Log.sendlevel?(:info)
- assert(@logs.find { |l| l.message =~ /not managing attribute #{a}/ and l.level == :info }, "No warning about failed %s" % a)
- end
+ # These may or may not get passed to the provider. We shouldn't care.
end
@logs.clear
@@ -288,6 +288,7 @@ class TestTypeAttributes < Test::Unit::TestCase
cleanup { Puppet::Type.rmtype(:unsupported) }
obj = type.new(:name => "test", :check => :yep)
+ obj.stubs(:newattr).returns(stub_everything("newattr"))
obj.expects(:newattr).with(:nope).never
obj[:check] = :all
end
diff --git a/test/ral/manager/type.rb b/test/ral/manager/type.rb
index ff3d0b0d2..f1dc437fd 100755
--- a/test/ral/manager/type.rb
+++ b/test/ral/manager/type.rb
@@ -65,7 +65,7 @@ class TestType < Test::Unit::TestCase
:ensure => "file"
)
- assert_raise(Puppet::Error, "Did not fail to alias when no catalog was available") {
+ assert_raise(Puppet::DevError, "It should fail to alias when no catalog was available") {
resource[:alias] = "funtest"
}
end