diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-12 16:57:34 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-01-12 16:57:34 +0000 |
| commit | c5782dfb9aa6ecfab045d348a7d07e38bcb4a8e2 (patch) | |
| tree | 94c0639ec0abf347a5891ea177319f7e6fc5348f /test | |
| parent | b0ea70db255f36977593a6373a189f63dc9a268f (diff) | |
| download | puppet-c5782dfb9aa6ecfab045d348a7d07e38bcb4a8e2.tar.gz puppet-c5782dfb9aa6ecfab045d348a7d07e38bcb4a8e2.tar.xz puppet-c5782dfb9aa6ecfab045d348a7d07e38bcb4a8e2.zip | |
Adding "content" state to files, and string interpolation handles escaped whitespace characters.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@813 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test')
| -rw-r--r-- | test/types/file.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/types/file.rb b/test/types/file.rb index 4aee2a4e9..f0bcf8ed6 100644 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -587,6 +587,46 @@ class TestFile < Test::Unit::TestCase comp = newcomp(subobj, baseobj) assert_events([:directory_created, :file_created], comp) end + + def test_content + file = tempfile() + str = "This is some content" + + obj = nil + assert_nothing_raised { + obj = Puppet.type(:file).create( + :name => file, + :content => str + ) + } + + assert(!obj.insync?, "Object is incorrectly in sync") + + assert_events([:file_created], obj) + + obj.retrieve + + assert(obj.insync?, "Object is not in sync") + + text = File.read(file) + + assert_equal(str, text, "Content did not copy correctly") + + newstr = "Another string, yo" + + obj[:content] = newstr + + assert(!obj.insync?, "Object is incorrectly in sync") + + assert_events([:file_changed], obj) + + text = File.read(file) + + assert_equal(newstr, text, "Content did not copy correctly") + + obj.retrieve + assert(obj.insync?, "Object is not in sync") + end end # $Id$ |
