exc = assert_raises Mongoid::Errors::Validations do subject.do_something end assert exc.message.include?("something failed")