Skip to content

Files

Latest commit

 

History

History
44 lines (28 loc) · 769 Bytes

RSpec-BeNil.md

File metadata and controls

44 lines (28 loc) · 769 Bytes

Pattern: Inconsistent style when matching nil

Issue: -

Description

Ensures a consistent style is used when matching nil.

You can either use the more specific be_nil matcher, or the more generic be matcher with a nil argument.

This rule can be configured using the EnforcedStyle option

Examples

EnforcedStyle: be_nil (default)

# bad
expect(foo).to be(nil)

# good
expect(foo).to be_nil

EnforcedStyle: be

# bad
expect(foo).to be_nil

# good
expect(foo).to be(nil)

Configurable attributes

Name Default value Configurable values
EnforcedStyle be_nil be, be_nil

Further Reading