Skip to content
Browse files

Make feature id in JSON output replace all spaces (close 127)

  • Loading branch information...
1 parent 4b24a82 commit b5bd31a0537080025d25c09c9dc69e245c11080c @pimterry pimterry committed with jbpros Dec 8, 2013
View
6 features/json_formatter.feature
@@ -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,
@@ -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": "",
@@ -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": "",
View
2 lib/cucumber/listener/json_formatter.js
@@ -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,
View
6 spec/cucumber/listener/json_formatter_spec.js
@@ -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,
@@ -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'

0 comments on commit b5bd31a

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