concept assertion in category ruby
appears as: ssertions, Assertions, An assertion, n assertion, assertion, ssertion, Assertion

This is an excerpt from Manning's book The Well-Grounded Rubyist, Third Edition.
Assertions and anchors are different types of creatures from characters. When you match a character (even based on a character class or wildcard), you’re said to be consuming a character in the string you’re matching. An assertion or an anchor, on the other hand, doesn’t consume any characters. Instead, it expresses a constraint: a condition that must be met before the matching of characters is allowed to proceed.
Listing 15.9. MicroTest, a testing class that emulates some MiniTest functionality
require_relative 'callertools' class MicroTest def self.inherited(c) c.class_eval do def self.method_added(m) if m =~ /^test/ #1 obj = self.new #2 if obj.methods.include?(:setup) #3 obj.setup end obj.send(m) end end end end def assert(assertion) #4 if assertion puts "Assertion passed" true else puts "Assertion failed:" stack = CallerTools::Stack.new #5 failure = stack.find {|call| call.meth !~ /assert/ } #5 puts failure false end end def assert_equal(expected, actual) #6 result = assert(expected == actual) puts "(#{actual} is not #{expected})" unless result #7 result end end !@%STYLE%@! {"css":"{\"css\": \"font-weight: bold;\"}","target":"[[{\"line\":5,\"ch\":61},{\"line\":5,\"ch\":63}],[{\"line\":6,\"ch\":61},{\"line\":6,\"ch\":63}],[{\"line\":7,\"ch\":61},{\"line\":7,\"ch\":63}],[{\"line\":15,\"ch\":61},{\"line\":15,\"ch\":63}],[{\"line\":21,\"ch\":61},{\"line\":21,\"ch\":63}],[{\"line\":22,\"ch\":61},{\"line\":22,\"ch\":63}],[{\"line\":21,\"ch\":61},{\"line\":21,\"ch\":63}],[{\"line\":22,\"ch\":61},{\"line\":22,\"ch\":63}],[{\"line\":27,\"ch\":61},{\"line\":27,\"ch\":63}],[{\"line\":29,\"ch\":61},{\"line\":29,\"ch\":63}]]"} !@%STYLE%@!