-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prefer block name 'given' over 'setup' #786
Prefer block name 'given' over 'setup' #786
Conversation
Codecov Report
@@ Coverage Diff @@
## master #786 +/- ##
============================================
+ Coverage 74.36% 74.38% +0.02%
- Complexity 3212 3218 +6
============================================
Files 347 348 +1
Lines 9931 9964 +33
Branches 1233 1236 +3
============================================
+ Hits 7385 7412 +27
- Misses 2103 2107 +4
- Partials 443 445 +2
Continue to review full report at Codecov.
|
docs/spock_primer.adoc
Outdated
or the end of the method. There are six kinds of blocks: `setup`, `when`, `then`, `expect`, `cleanup`, and `where` blocks. | ||
Any statements between the beginning of the method and the first explicit block belong to an implicit `setup` block. | ||
or the end of the method. There are six kinds of blocks: `given`, `when`, `then`, `expect`, `cleanup`, and `where` blocks. | ||
Any statements between the beginning of the method and the first explicit block belong to an implicit `given` given block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one given
to many
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change made.
docs/spock_primer.adoc
Outdated
other blocks, and may not be repeated. A `setup` block doesn't have any special semantics. The `setup:` label is | ||
optional and may be omitted, resulting in an _implicit_ `setup` block. The `given:` label is an alias for `setup:`, | ||
and sometimes leads to a more readable feature method description (see <<specs-as-doc,Specifications as Documentation>>). | ||
The `given` block is where you do any configuration for the feature that you are describing. It may not be preceded by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think setup work
is better than configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change made.
@@ -540,6 +542,8 @@ with(service) { | |||
1 * stop() | |||
} | |||
---- | |||
|
|||
[[specifications_as_documentation]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will conflict with your other #787 please align them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added these lines to this file in #787 per request.
docs/spock_primer.adoc
Outdated
|
||
`@IgnoreRest`:: Ignores all feature methods not carrying this annotation. Useful for quickly running just a single method. | ||
`@IgnoreRest`:: Any feature method carrying this annotation will be executed, all others will be ignored. Useful |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please set your IDE to softwraps instead of introducing needless newlines. Also fix the other additional line breaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change made to align with current line breaks.
Prefer block name 'given' over 'setup'
With the growing popularity of the given-when-then style of specification writing, I think it makes sense to have most of the example specifications use 'given:' instead of 'setup:'
Docs have been reworked so that they show 'given:' in place of 'setup:' everywhere except the part that explains that 'setup:' was the original name for the block and is now an alias for 'given"'.
Also reordered the listing of setup, cleanup, setupSpec, and cleanupSpec to reflect the order in which they are executed, and some rewording in the interaction_nased_testing.adoc file to make things clearer.