Skip to content

Commit

Permalink
Make feature id in JSON output replace all spaces (close 127)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Perry authored and jbpros committed Dec 11, 2013
1 parent 4b24a82 commit b5bd31a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions features/json_formatter.feature
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ Feature: JSON Formatter
"""
[
{
"id": "one-passes one fails",
"id": "one-passes-one-fails",
"name": "one passes one fails",
"description": "",
"line": 1,
Expand All @@ -505,7 +505,7 @@ Feature: JSON Formatter
"elements": [
{
"name": "This one passes",
"id": "one-passes one fails;this-one-passes",
"id": "one-passes-one-fails;this-one-passes",
"line": 3,
"keyword": "Scenario",
"description": "",
Expand All @@ -526,7 +526,7 @@ Feature: JSON Formatter
},
{
"name": "This one fails",
"id": "one-passes one fails;this-one-fails",
"id": "one-passes-one-fails;this-one-fails",
"line": 5,
"keyword": "Scenario",
"description": "",
Expand Down
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 b5bd31a

Please sign in to comment.