Skip to content
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

Merged
merged 3 commits into from
Nov 22, 2017

Conversation

BurkHufnagel
Copy link
Contributor

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.

@codecov
Copy link

codecov bot commented Oct 29, 2017

Codecov Report

Merging #786 into master will increase coverage by 0.02%.
The diff coverage is 82.85%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
.../src/main/java/spock/mock/DetachedMockFactory.java 100% <ø> (ø) 13 <0> (ø) ⬇️
...ava/org/spockframework/guice/GuiceInterceptor.java 88.23% <100%> (+1.13%) 11 <2> (+2) ⬆️
.../src/main/java/spock/mock/AutoAttachExtension.java 80% <80%> (ø) 4 <4> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d91bf78...e990059. Read the comment docs.

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.
Copy link
Member

@leonard84 leonard84 Nov 15, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one given to many

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change made.

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
Copy link
Member

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

Copy link
Contributor Author

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]]
Copy link
Member

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

Copy link
Contributor Author

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.


`@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
Copy link
Member

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.

Copy link
Contributor Author

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.

BurkHufnagel added a commit to BurkHufnagel/spock that referenced this pull request Nov 21, 2017
@leonard84 leonard84 merged commit 94412e7 into spockframework:master Nov 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants