# Stricter Tests for Expectations Set on Nil in RSpec

DevFeed: [Stricter Tests for Expectations Set on Nil in RSpec](<https://devfeed.tech/articles/stricter-tests-for-expectations-set-on-nil-in-rspec-15898.md>)

Original publisher: [Read original article](<https://developer.squareup.com/blog/stricter-tests-for-expectations-set-on-nil-in-rspec>)

Author: Square Engineering

Published: 2015-06-19T07:00:00Z

Content type: tutorial

Language: en

Sources: [Square Corner Blog RSS Feed](<https://devfeed.tech/sources/square-corner-blog-rss-feed.md>)

Topics: [RSpec](<https://devfeed.tech/topics/rspec.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [bug](<https://devfeed.tech/topics/bug.md>), [Code review](<https://devfeed.tech/topics/code-review.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [code-review](<https://devfeed.tech/tags/code-review.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [testing](<https://devfeed.tech/tags/testing.md>), [tests](<https://devfeed.tech/tags/tests.md>)

## AI overview

This article explains how Square implemented stricter RSpec behavior so tests fail when message expectations are set on nil, helping catch false positives that warnings alone may leave unnoticed.

## Source excerpt

Make your RSpec tests fail when expectations are set on nil.