Skip to content

Commit

Permalink
Make feature id in JSON formatting replace *all* spaces, fixes cucumb…
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Dec 8, 2013
1 parent 4b24a82 commit 6c95e2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/cucumber/listener/json_formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var JsonFormatter = function(options) {

self.handleBeforeFeatureEvent = function handleBeforeFeatureEvent(event, callback) {
var feature = event.getPayloadItem('feature');
currentFeatureId = feature.getName().replace(' ', '-'); // FIXME: wrong abstraction level, this should be encapsulated "somewhere"
currentFeatureId = feature.getName().replace(/ /g, '-'); // FIXME: wrong abstraction level, this should be encapsulated "somewhere"

var featureProperties = {
id: currentFeatureId,
Expand Down
6 changes: 3 additions & 3 deletions spec/cucumber/listener/json_formatter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("Cucumber.Listener.JsonFormatterWrapper", function () {
beforeEach(function () {
feature = createSpyWithStubs("feature", {
getKeyword: 'Feature',
getName: 'A Name',
getName: 'A Feature Name',
getDescription: 'A Description',
getLine: 3,
getUri: undefined,
Expand All @@ -39,8 +39,8 @@ describe("Cucumber.Listener.JsonFormatterWrapper", function () {
listener.handleBeforeFeatureEvent(event, callback);
expect(formatter.uri).toHaveBeenCalledWith(undefined);
expect(formatter.feature).toHaveBeenCalledWith({
id: 'A-Name',
name: 'A Name',
id: 'A-Feature-Name',
name: 'A Feature Name',
description: 'A Description',
line: 3,
keyword: 'Feature'
Expand Down

0 comments on commit 6c95e2d

Please sign in to comment.