Spectator::Matchers::TruthyMatcher
Inherits Spectator::Matchers::StandardMatcher / Spectator::Matchers::Matcher / Struct / Value / Object
Matcher that tests whether a value is truthy or falsey. Falsey means a value is considered false by an if-statement, which are false and nil in Crystal. Truthy is the opposite of falsey.
Additionally, different matchers can be created
by using the #<, #<=, #>, #>=, #==, and #!= operators.
Constructors
Creates the truthy matcher. The truthy argument should be true to match "truthy" values, and false to match "falsey" values.
Instance methods
Creates a matcher that checks if a value is not equal to an expected value. The spec would look like:
expect(0).to be != 1
Creates a matcher that checks if a value is less than an expected value. The spec would look like:
expect(0).to be < 1
Creates a matcher that checks if a value is less than or equal to an expected value. The spec would look like:
expect(0).to be <= 1
Creates a matcher that checks if a value is equal to an expected value. The spec would look like:
expect(0).to be == 0
Creates a matcher that checks if a value is semantically equal to an expected value. The spec would look like:
expect("foobar").to be === /foo/
Creates a matcher that checks if a value matches the pattern of an expected value. The spec would look like:
expect("foobar").to be =~ /foo/
Creates a matcher that checks if a value is greater than an expected value. The spec would look like:
expect(2).to be > 1
Creates a matcher that checks if a value is greater than or equal to an expected value. The spec would look like:
expect(2).to be >= 1
Short text about the matcher's purpose. This explains what condition satisfies the matcher. The description is used when the one-liner syntax is used.