Build Robust & Production Quality Applications - Lesson 2: Shoulda Matchers

With rspec, there comes built-in matchers, which can be found: shoulda matchers

1. Object Identity:

You should use "Object Equivalence" instead because you will be testing if the two objects are the same when in reality they may equal the same but be different objects

2. Comparison

actual should.be > expected

3. Types of Classes

test whether the actual is an instance of a class

4. Truthiness and Existentialism

tests whether the actual is truthy(not nil or false)

5. Expecting errors

6. Expecting Throws

Expecting methods to throw a symbol * Predicate Matchers - passes if method returns a truthy result

7. Collection Membership

testing whether an array is a subset of the expected

8. Ranges (only for Ruby 1.9)

Also matchers worth mentioning: