Skip to content

Commit

Permalink
tag support for outline scenario examples , cucumber#195
Browse files Browse the repository at this point in the history
  • Loading branch information
akania committed Jun 15, 2014
1 parent 745c40d commit 5b9994a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion lib/cucumber/ast/assembler.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ var Assembler = function (features, filter) {
element.addTags(revealedTags);
},

applyStashedTagsToOutlineElement: function applyStashedTagsToOutlineElement(element) {
element.addTags(stashedTags);
},

insertBackground: function insertBackground(background) {
self.setCurrentScenarioOrBackground(background);
var currentFeature = self.getCurrentFeature();
Expand Down Expand Up @@ -83,6 +87,16 @@ var Assembler = function (features, filter) {
}
},

insertOutlineScenario: function insertOutlineScenario(scenario) {
self.applyCurrentFeatureTagsToElement(scenario);
self.applyStashedTagsToOutlineElement(scenario);
self.setCurrentScenarioOrBackground(scenario);
if (filter.isElementEnrolled(scenario)) {
var currentFeature = self.getCurrentFeature();
currentFeature.addFeatureElement(scenario);
}
},

insertExamples: function insertExamples(examples) {
var currentScenarioOrBackground = self.getCurrentScenarioOrBackground();
if (currentScenarioOrBackground.payloadType == 'scenarioOutline')
Expand All @@ -104,7 +118,7 @@ var Assembler = function (features, filter) {

convertScenarioOutlineToScenarios: function convertScenarioOutlineToScenarios(scenario){
var subScenarios = scenario.buildScenarios();
subScenarios.syncForEach(self.insertScenario);
subScenarios.syncForEach(self.insertOutlineScenario);
},

convertScenarioOutlinesToScenarios: function convertScenarioOutlinesToScenarios(){
Expand Down
2 changes: 1 addition & 1 deletion lib/cucumber/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ var Parser = function(featureSources, astFilter) {
handleScenarioOutline: function handleScenarioOutline(keyword, name, description, line) {
var uri = self.getCurrentSourceUri();
var outline = Cucumber.Ast.ScenarioOutline(keyword, name, description, uri, line);
astAssembler.insertScenario(outline);
astAssembler.insertOutlineScenario(outline);
},

handleExamples: function handleExamples(keyword, name, description, line) {
Expand Down

0 comments on commit 5b9994a

Please sign in to comment.