-
Notifications
You must be signed in to change notification settings - Fork 23
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
Consider patch release branch: Gherkin glitches #127
base: master
Are you sure you want to change the base?
Consider patch release branch: Gherkin glitches #127
Conversation
final Suite suite = DeclarationState.instance().getCurrentSuiteBeingDeclared() | ||
.addCompositeSuite("Scenario: " + scenarioName); | ||
DeclarationState.instance().beginDeclaration(suite, block); | ||
addComposite("Scenario: " + scenarioName, 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.
Extracted out to a helper as needed below.
@@ -155,14 +152,14 @@ static void and(final String behavior, final Block block) { | |||
describe("Scenario outline: " + name, () -> { | |||
describe("Examples:", () -> { | |||
examples.rows().forEach(example -> { | |||
describe(example.toString(), () -> example.runDeclaration(block)); | |||
addComposite(example.toString(), () -> example.runDeclaration(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.
describe
did not create a composite test as scenario
did
.addSuite(context); | ||
suite.applyPreconditions(block); | ||
DeclarationState.instance().beginDeclaration(suite, block); | ||
addSuiteInternal(parent -> parent.addSuite(context), 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.
There some stuff about creating a suite that was common to more than one implementation - extracted out to a common helper.
.getCurrentSuiteBeingDeclared()); | ||
suite.applyPreconditions(block); | ||
DeclarationState.instance().beginDeclaration(suite, 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.
The applyPreconditions
bit wasn't being applied to gherkin
. Similarly, the boilerplate around getCurrentSuite...
and beginDeclaration...
felt like it should be written once and specialised every time it was used.
@@ -126,7 +126,8 @@ public void addHook(final HookContext hook) { | |||
} | |||
|
|||
private Hooks getHooksFor(final Child child) { | |||
Hooks allHooks = this.parent.getInheritableHooks().plus(this.hooks); | |||
Hooks allHooks = isAtomic() ? new Hooks() : this.parent.getInheritableHooks(); |
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 is the thing which stops an atomic parent conveying its own inherited hooks down to a child.
}); | ||
|
||
then("the data is still there", () -> { | ||
assertThat(list.get().get(0), is("hello")); |
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.
Before the fix, this was failing as the let
was being freshened for both given
and then
}); | ||
then("the block configuration will have applied", () -> { | ||
assertThat(result.get().getRunCount(), is(1)); | ||
assertThat(result.get().getIgnoreCount(), is(1)); |
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.
Before the fixes, the with(focus()...
didn't work for gherkin
}); | ||
then("both are found in the set", () -> { | ||
assertTrue(set.get().contains(first)); | ||
assertTrue(set.get().contains(second)); |
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.
Even after one of the fixes, this wasn't going to work because the scenarioOutline
wasn't generating actual scenarios...
@ashleyfrieze I will merge this, but there's a small conflict with |
Fixes for inconsistencies in hook and configuration behaviour with Gherkin Syntax