Skip to content

Files

Latest commit

 

History

History
28 lines (19 loc) · 500 Bytes

RSpec-SubjectDeclaration.md

File metadata and controls

28 lines (19 loc) · 500 Bytes

Pattern: Ambiguous declaration of subject

Issue: -

Description

Ensure that subject is defined using subject helper.

Examples

# bad
let(:subject) { foo }
let!(:subject) { foo }
subject(:subject) { foo }
subject!(:subject) { foo }

# bad
block = -> {}
let(:subject, &block)

# good
subject(:test_subject) { foo }

Further Reading