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

Fix contextual And handling #73

Merged
merged 3 commits into from
Jul 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cucumberish/Core/Managers/CCIStepsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ - (CCIStepDefinition *)findDefinitionForStep:(CCIStep *)step amongDefinitions:(N

- (void)executeStep:(CCIStep *)step inTestCase:(id)testCase
{
if (![step.keyword isEqualToString:@"And"]) {
if (step.keyword && ![step.keyword isEqualToString:@"And"]) {
self.currentContextKeyword = step.keyword;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ -(void)setup
{
Given(@"a(n)? (.*) statement", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {

});

Given(@"an And statement defined with the keyword Given", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {

});

Given(@"a Given statement using the step method in its implementation", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {
step(nil, @"An empty step");
});

Given(@"An empty step", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {

});

When(@"a(n)? (.*) statement", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {
Expand Down Expand Up @@ -99,6 +111,17 @@ -(void)setup

}
});

Then(@"the And statement should be defined", ^(NSArray<NSString *> *args, NSDictionary *userInfo) {
CCIFeature *feature = [CCIFeaturesManager instance].features.firstObject;
CCIScenarioDefinition *mainScenario = feature.scenarioDefinitions.firstObject;

[mainScenario.steps enumerateObjectsUsingBlock:^(CCIStep * _Nonnull step, NSUInteger idx, BOOL * _Nonnull stop) {
if ([step.keyword isEqualToString:@"And"] && step.status != CCIStepStatusPassed) {
*stop = YES;
}
}];
});


When(@"cucumber outputs the details of \"JSON Output\" to a JSON to a file", ^(NSArray<NSString *> *args, NSDictionary *userInfo){
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Feature: Contextual And Handling

Scenario: Contextual And Handling
Given a Given statement
And an And statement defined with the keyword Given
Then the And statement should be defined

Scenario: Contextual And Handling using the step() method
Given a Given statement using the step method in its implementation
And an And statement defined with the keyword Given
Then the And statement should be defined