let
is a lazy-loaded memoized helper method, meaning that it won't be evaluated until the first time it's called.
let!
forces the method's evaluation before each example
The first argument to the outermost example group:
RSpec.describe MyClass do
described_class # => MyClass
end
implicit - the first argument to the outermost example group (see above)
explicit - defined by subject
,
subject { MyClass.new(arg1) }
- named explicit:
subject(:my_subject) { MyClass.new(arg1) }
Provides a nice syntax for creating one-liner tests of common Rails functionality:
it { validates_presence_of :name }