Skip to content

Commit

Permalink
Bump gherkin and reflect changes in its API (add DocString content type)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbpros committed Sep 12, 2011
1 parent 42b0301 commit 8f909a0
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions lib/cucumber/ast/doc_string.js
@@ -1,9 +1,9 @@
var DocString = function(string, line) {
var DocString = function(contentType, string, line) {
var self = {
getString: function getString() {
return string;
}
};
return self;
};
module.exports = DocString;
module.exports = DocString;
4 changes: 2 additions & 2 deletions lib/cucumber/parser.js
Expand Up @@ -68,8 +68,8 @@ var Parser = function(featureSources) {
currentScenarioOrBackground.addStep(step);
},

handleDocString: function handleDocString(string, line) {
var docString = Cucumber.Ast.DocString(string, line);
handleDocString: function handleDocString(contentType, string, line) {
var docString = Cucumber.Ast.DocString(contentType, string, line);
var currentStep = self.getCurrentStep();
currentStep.attachDocString(docString);
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -18,7 +18,7 @@
, "main" : "./lib/cucumber"
, "engines" : { "node" : "0.4 || 0.5" }
, "dependencies" :
{ "gherkin" : "2.4.5"
{ "gherkin" : "2.4.18"
, "jasmine-node" : "1.0.6"
, "connect" : "1.6.0"
, "browserify" : "1.4.6"
Expand Down
7 changes: 4 additions & 3 deletions spec/cucumber/ast/doc_string_spec.js
Expand Up @@ -5,9 +5,10 @@ describe("Cucumber.Ast.DocString", function() {
var docString, string, line;

beforeEach(function() {
string = createSpy("DocString string");
line = createSpy("DocString line number");
docString = Cucumber.Ast.DocString(string, line);
contentType = createSpy("content type");
string = createSpy("DocString string");
line = createSpy("DocString line number");
docString = Cucumber.Ast.DocString(contentType, string, line);
});

describe("getString()", function() {
Expand Down
13 changes: 7 additions & 6 deletions spec/cucumber/parser_spec.js
Expand Up @@ -323,30 +323,31 @@ describe("Cucumber.Parser", function() {
});

describe("handleDocString()", function() {
var string, line;
var contentType, string, line;
var currentStep;

beforeEach(function() {
contentType = createSpy("DocString's content type");
string = createSpy("DocString's actual string");
line = createSpy("Line number");
line = createSpy("line number");
docString = createSpy("DocString AST element");
currentStep = createSpyWithStubs("Current step", {attachDocString: null});
spyOn(Cucumber.Ast, 'DocString').andReturn(docString);
spyOn(parser, 'getCurrentStep').andReturn(currentStep);
});

it("creates a new DocString AST element", function() {
parser.handleDocString(string, line);
expect(Cucumber.Ast.DocString).toHaveBeenCalledWith(string, line);
parser.handleDocString(contentType, string, line);
expect(Cucumber.Ast.DocString).toHaveBeenCalledWith(contentType, string, line);
});

it("gets the current step AST element", function() {
parser.handleDocString(string, line);
parser.handleDocString(contentType, string, line);
expect(parser.getCurrentStep).toHaveBeenCalled();
});

it("attaches the DocString element to the current step", function() {
parser.handleDocString(string, line);
parser.handleDocString(contentType, string, line);
expect(currentStep.attachDocString).toHaveBeenCalledWith(docString);
});
});
Expand Down

0 comments on commit 8f909a0

Please sign in to comment.