summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-30 14:42:46 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-30 14:42:46 +0000
commitff6562f9fa1ddf7e816256764f1bcc491693df9f (patch)
tree997344c5d94d56b56cd957d441f282e9cbb5cf5f /test
parent9bb9e1062a7bf747d1972d69eca9f00d2c0bd030 (diff)
Fixing #133. Added a "notify" and a "before" metaparam; notify is the opposite of subscribe, and before is the opposite of require.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1344 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
-rw-r--r--test/types/type.rb48
1 files changed, 48 insertions, 0 deletions
diff --git a/test/types/type.rb b/test/types/type.rb
index 0c21c034c..a47050057 100644
--- a/test/types/type.rb
+++ b/test/types/type.rb
@@ -415,6 +415,54 @@ end
assert_equal(parammethod, Puppet::Type.method(:newparam),
"newparam method got replaced by newtype")
end
+
+ def test_notify_metaparam
+ file = Puppet::Type.newfile(
+ :path => tempfile(),
+ :notify => ["exec", "notifytest"],
+ :ensure => :file
+ )
+
+ path = tempfile()
+ exec = Puppet::Type.newexec(
+ :name => "notifytest",
+ :command => "/bin/touch #{path}",
+ :refreshonly => true
+ )
+
+ assert_apply(file, exec)
+
+ assert(exec.requires?(file),
+ "Notify did not correctly set up the requirement chain.")
+
+ assert(FileTest.exists?(path),
+ "Exec path did not get created.")
+ end
+
+ def test_before_metaparam
+ file = Puppet::Type.newfile(
+ :path => tempfile(),
+ :before => ["exec", "beforetest"],
+ :content => "yaytest"
+ )
+
+ path = tempfile()
+ exec = Puppet::Type.newexec(
+ :name => "beforetest",
+ :command => "/bin/cp #{file[:path]} #{path}"
+ )
+
+ assert_apply(file, exec)
+
+ assert(exec.requires?(file),
+ "Before did not correctly set up the requirement chain.")
+
+ assert(FileTest.exists?(path),
+ "Exec path did not get created.")
+
+ assert_equal("yaytest", File.read(path),
+ "Exec did not correctly copy file.")
+ end
end
# $Id$