Skip to content

Files

Latest commit

 

History

History
35 lines (25 loc) · 593 Bytes

Airbnb-SpecConstantAssignment.md

File metadata and controls

35 lines (25 loc) · 593 Bytes

Pattern: Constant assignment in pec

Issue: -

Description

Checks for constant assignment inside of specs.

Examples

# bad
describe Something do
  PAYLOAD = [1, 2, 3]
end

# good
describe Something do
  let(:payload)  { [1, 2, 3] }
end

# bad
describe Something do
  MyClass::PAYLOAD = [1, 2, 3]
end

# good
describe Something do
  before { stub_const('MyClass::PAYLOAD', [1, 2, 3])
end

Further Reading