判断字符串的一些tests
lower:判断包含字母的字符串中的字母是否为纯小写,字符串中的字母全部为小写则返回真
upper:判断包含字母的字符串中的字母是否为纯大写,字符串中的字母全部为大写则返回真。
判断整除的一些tests
even:判断数值是否为偶数,是偶数则返回真
odd:判断数值是否为奇数,是奇数则返回真
divisibleby:判断是否可以整除指定的数值,如果除以指定的值以后余数为0,则返回真。
其他的一些test
version:可以用于对比两个版本号的大小,或者与指定的版本号进行对比,使用语法为version(“版本号”,“比较操作符”)当使用version时,支持多种风格的比较操作符,version支持的比较操作符如下:
大于:>,gt
大于等于:>=,ge
小于:<,lt
小于等于:<=,le
等于:==,=,eq
不等于:!=,<>,ne
subset:判断一个list是不是另一个list的子集,是另一个list的子集时返回真
superset:判断一个list是不是另一个list的父集,是另一个list的父集时返回真
顺利执行block,则不会执行rescue