I need to assert if a returned string contains one or another substring.
I'm writing it like this:
if mail.subject.include?('Pragmatic Store Order Confirmation')
assert_equal 'Pragmatic Store Order Confirmation', mail.subject
else
assert_equal 'There was an error with your payment', mail.subject
end
However I would like to know how to write it as one line with assert_equal or assert_match I tried
assert_match( /(Pragmatic Store Order Confirmation) (There was an error with your payment)/, mail.subject )
But i just cant figure out how it or regexp works. Hope I've made myself clear. Thanks!
Aucun commentaire:
Enregistrer un commentaire