rubocop / rspec-style-guide

Best practices for writing your specs!
http://rspec.rubystyle.guide
953 stars 118 forks source link

Added section on the declaration order of subject, let!/let and before/after hooks #135

Closed schinery closed 11 months ago

schinery commented 11 months ago

Added section on the declaration order of subject, let!/let and before/after hooks to the Example Group Structure section.

Screenshot 2023-10-05 at 07 50 10

Also, moved [Leading Subject] to the Example Group Structure section, as mentioned below.

Screenshot 2023-10-05 at 07 46 28

Resolves https://github.com/rubocop/rspec-style-guide/issues/134

schinery commented 11 months ago

Thanks for handling this!

Suggestions:

  1. Keep the existing leading-subject guideline as is. There are external resources linking to guidelines, and we don’t want to break them. There’s a workaround to specify a legance anchor name.
  2. I’d move both guidelines to the example group structure section.
  3. Let’s call them “hooks”

@pirj hoping I've done these suggestions correctly. Please let me know if this needs any more amends.

pirj commented 11 months ago

Thank you, @schinery !