summaryrefslogtreecommitdiff
path: root/t/test-custodian-testfactory.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2012-11-23 15:46:12 +0000
committerSteve Kemp <steve@steve.org.uk>2012-11-23 15:46:12 +0000
commitb42677d69de3dab1a55c81689cf2b3b45fd85d12 (patch)
tree3c17d871d9ba42496ff23f05522b99bd43bcb7bb /t/test-custodian-testfactory.rb
parentcaaa448c8826e4409d5db5398943e8c1ef54818d (diff)
Removed duplicate member-variables for subclasses.
Allow test-inversion via "must not run".
Diffstat (limited to 't/test-custodian-testfactory.rb')
-rwxr-xr-xt/test-custodian-testfactory.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/test-custodian-testfactory.rb b/t/test-custodian-testfactory.rb
index 9aeb6e1..db79f50 100755
--- a/t/test-custodian-testfactory.rb
+++ b/t/test-custodian-testfactory.rb
@@ -137,6 +137,36 @@ class TestTestFactory < Test::Unit::TestCase
assert( Custodian::TestFactory.create( "ftp://example.com/ must not run rsync." ) )
assert( Custodian::TestFactory.create( "ftp://example.com/ must not run rsync on 333." ) )
end
+
+
+ #
+ # Test some inversions
+ #
+ data = {
+ "foo must run rsync." => false,
+ "rsync://foo/ must run rsync." => false,
+ "foo must run ping otherwise" => false,
+ "foo must not run ping otherwise" => true,
+ "foo must not run ssh otherwise" => true,
+ "foo must not run ldap otherwise" => true,
+ }
+
+ #
+ # Run each test
+ #
+ data.each do |str,inv|
+ assert_nothing_raised do
+
+ obj = Custodian::TestFactory.create( str )
+
+ #
+ # Ensure we got the object, and the port was correct.
+ #
+ assert(obj, "created object via TestFactory.create('#{str}')")
+ assert( obj.inverted() == inv, "#{str} -> #{inv}" )
+ end
+ end
+
end
end