I've got a situation where I need to validate some regular expressions.
So, during my application run, I may want to test that a particular regex:
- Contains no spaces
- Contains only a certain number of capture groups
- Does not use certain characters
- Only contains a certain number of wildcards
rspec seems like the perfect tool for doing this. I realize that it's typically used to test application interfaces, assumptions and logic before an application is run, however. But, the natural syntax combined with the automatic reporting output would be nice to have.
Questions: Is this an appropriate use of rspec?
How can one call a description from within a running application?
Or, should I abandon this approach and simply write methods within my class to perform the validations?