Skip to content
Browse files

Include 'features' in *Features events payload

  • Loading branch information...
1 parent ca9bea3 commit bab6e4fe58d67e6e70cfbd34eee8a5a86b3c3430 @shyiko shyiko committed with jbpros May 18, 2014
View
4 lib/cucumber/ast/features.js
@@ -8,6 +8,10 @@ var Features = function() {
features.add(feature);
},
+ getFeatures: function getFeatures() {
+ return features;
+ },
+
getLastFeature: function getLastFeature() {
return features.getLast();
},
View
3 lib/cucumber/runtime/ast_tree_walker.js
@@ -14,7 +14,8 @@ var AstTreeWalker = function(features, supportCodeLibrary, listeners) {
},
visitFeatures: function visitFeatures(features, callback) {
- var event = AstTreeWalker.Event(AstTreeWalker.FEATURES_EVENT_NAME);
+ var payload = { features: features };
+ var event = AstTreeWalker.Event(AstTreeWalker.FEATURES_EVENT_NAME, payload);
self.broadcastEventAroundUserFunction(
event,
function(callback) { features.acceptVisitor(self, callback); },
View
5 spec/cucumber/runtime/ast_tree_walker_spec.js
@@ -54,18 +54,19 @@ describe("Cucumber.Runtime.AstTreeWalker", function() {
});
describe("visitFeatures()", function() {
- var callback, event;
+ var callback, event, payload;
beforeEach(function() {
callback = createSpy("Callback");
event = createSpy("Event");
+ payload = {features: features};
spyOn(Cucumber.Runtime.AstTreeWalker, 'Event').andReturn(event);
spyOn(treeWalker, 'broadcastEventAroundUserFunction');
});
it("creates a new event about the features' visit", function() {
treeWalker.visitFeatures(features, callback);
- expect(Cucumber.Runtime.AstTreeWalker.Event).toHaveBeenCalledWith(Cucumber.Runtime.AstTreeWalker.FEATURES_EVENT_NAME);
+ expect(Cucumber.Runtime.AstTreeWalker.Event).toHaveBeenCalledWith(Cucumber.Runtime.AstTreeWalker.FEATURES_EVENT_NAME, payload);
});
it("broadcasts the visit of the features", function() {

0 comments on commit bab6e4f

Please sign in to comment.
Something went wrong with that request. Please try again.