summaryrefslogtreecommitdiffstats
path: root/test/util/classgen.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-07 20:52:19 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-10-07 20:52:19 +0000
commit34f8337c68ff6f4b8ff57e604bae77529eb0d16e (patch)
treed7188575a0ec20c4082990afbf6b907146da364e /test/util/classgen.rb
parent5b6ee8c823a78f26cd1a1ad957da3d234910b9c2 (diff)
downloadpuppet-34f8337c68ff6f4b8ff57e604bae77529eb0d16e.tar.gz
puppet-34f8337c68ff6f4b8ff57e604bae77529eb0d16e.tar.xz
puppet-34f8337c68ff6f4b8ff57e604bae77529eb0d16e.zip
Refactoring reporting. Reports are now modules instead of simple methods.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1746 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'test/util/classgen.rb')
-rwxr-xr-xtest/util/classgen.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/util/classgen.rb b/test/util/classgen.rb
index 160de7464..3c49f5ce9 100755
--- a/test/util/classgen.rb
+++ b/test/util/classgen.rb
@@ -115,6 +115,30 @@ class TestPuppetUtilClassGen < Test::Unit::TestCase
assert_nil(klass.three, "Class was initialized incorrectly")
end
+ def test_initclass_include_and_extend
+ sub, klass = testclasses("attributes")
+
+ incl = Module.new do
+ attr_accessor :included
+ end
+ self.class.const_set("Incl", incl)
+
+ ext = Module.new do
+ attr_accessor :extended
+ end
+ self.class.const_set("Ext", ext)
+
+ assert(! klass.respond_to?(:extended), "Class already responds to extended")
+ assert(! klass.new.respond_to?(:included), "Class already responds to included")
+
+ assert_nothing_raised do sub.send(:initclass, klass,
+ :include => incl, :extend => ext)
+ end
+
+ assert(klass.respond_to?(:extended), "Class did not get extended")
+ assert(klass.new.respond_to?(:included), "Class did not include")
+ end
+
def test_genclass
hash = {}
array = []