From 04782ef9d184cf1de362f1a42fa8f48e5e7aa697 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Thu, 22 Feb 2018 14:22:37 +0200 Subject: Allow tests to set a subject. This updates the parser, globally, to allow: .... with subject 'xxx' --- lib/custodian/testfactory.rb | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) 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 # -- cgit v1.2.1