summaryrefslogtreecommitdiff
path: root/lib/custodian/testfactory.rb
diff options
context:
space:
mode:
authorSteve Kemp <steve@steve.org.uk>2018-02-22 14:22:37 +0200
committerSteve Kemp <steve@steve.org.uk>2018-02-22 14:22:37 +0200
commit04782ef9d184cf1de362f1a42fa8f48e5e7aa697 (patch)
tree9f2c60dd0e0b7db5cb30d19fc87bbba28671071c /lib/custodian/testfactory.rb
parent8fed21ce4af972799634aaa4b44c09184034734a (diff)
Allow tests to set a subject.
This updates the parser, globally, to allow: .... with subject 'xxx'
Diffstat (limited to 'lib/custodian/testfactory.rb')
-rw-r--r--lib/custodian/testfactory.rb27
1 files changed, 26 insertions, 1 deletions
diff --git a/lib/custodian/testfactory.rb b/lib/custodian/testfactory.rb
index db3f339..358e676 100644
--- a/lib/custodian/testfactory.rb
+++ b/lib/custodian/testfactory.rb
@@ -99,10 +99,21 @@ module Custodian
#
# We do this only after we've instantiated the test.
#
- if line =~ /\s+otherwise\s+'([^']+)'/
+ if line =~ /\s+otherwise\s+'([^']+)'/
obj.set_notification_text($1.dup)
end
+
+ #
+ # Some tests will replace their subject.
+ #
+ #
+ if line =~ /\s+with\s+subject\s+'([^']+)'/
+ obj.set_subject($1.dup)
+ else
+ obj.set_subject( nil )
+ end
+
#
# Is the test inverted?
#
@@ -168,6 +179,20 @@ module Custodian
end
+ #
+ # If this test has a custom subject then return it
+ #
+ def get_subject
+ @subject
+ end
+
+
+ #
+ # Setup a custom subject for the (mauve) alert we raise
+ #
+ def set_subject( subject )
+ @subject = subject
+ end
#