Examples:
matcher = eql("foo") matcher.matches? { "foo" } matcher.matches? { "bar" }
matcher = eq("foo") matcher.matches? { "foo" } matcher.matches? { "bar" }
object = "foo"
matcher = equal(object) matcher.matches? { object } matcher.matches? { "foo" }
matcher = be(object) matcher.matches? { object } matcher.matches? { "foo" }
Regular expressions matcher
matcher = match(/^foo$/) matcher.matches? { "foo" } matcher.matches? { "bar" }
matcher = raise_exception(NameError) matcher.matches? { Boom } matcher.matches? { true }
matcher = be_true matcher.matches? { true } matcher.matches? { false } matcher.matches? { nil } matcher.matches? { 4 }
matcher = be_false matcher.matches? { false } matcher.matches? { true } matcher.matches? { nil } matcher.matches? { 4 }
matcher = be_nil matcher.matches? { nil } matcher.matches? { false } matcher.matches? { true } matcher.matches? { 4 }
matcher = be_instance_of(String) matcher.matches? { "foo" } matcher.matches? { 4 }
matcher = be_an_instance_of(String) matcher.matches? { "foo" } matcher.matches? { 4 }