Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Output step definition snippets in CoffeeScript
- Loading branch information
1 parent
41e0895
commit 336ca0f
Showing
12 changed files
with
326 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
lib/cucumber/support_code/step_definition_snippet_builder_syntax.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
var _ = require('underscore'), | ||
Syntax = function() {}, | ||
JavaScriptSyntax = function() {}, | ||
CoffeeScriptSyntax = function() {}; | ||
|
||
Syntax.prototype = { | ||
getStepDefinitionDocString: function() { | ||
return 'string'; | ||
}, | ||
|
||
getStepDefinitionDataTable: function() { | ||
return 'table'; | ||
}, | ||
|
||
getStepDefinitionCallback: function() { | ||
return 'callback'; | ||
}, | ||
|
||
getPatternStart: function() { | ||
return '/^'; | ||
}, | ||
|
||
getPatternEnd: function() { | ||
return '$/'; | ||
}, | ||
|
||
getContextStepDefinitionFunctionName: function() { | ||
return 'Given'; | ||
}, | ||
|
||
getEventStepDefinitionFunctionName: function() { | ||
return 'When'; | ||
}, | ||
|
||
getOutcomeStepDefinitionFunctionName: function() { | ||
return 'Then'; | ||
}, | ||
|
||
getNumberMatchingGroup: function() { | ||
return '(\\d+)'; | ||
}, | ||
|
||
getQuotedStringMatchingGroup: function() { | ||
return '"([^"]*)"'; | ||
}, | ||
|
||
getFunctionParameterSeparator: function() { | ||
return ', '; | ||
}, | ||
|
||
getStepDefinitionEndComment: function() { | ||
return 'express the regexp above with the code you wish you had'; | ||
} | ||
}; | ||
|
||
JavaScriptSyntax.prototype = { | ||
getStepDefinitionStart: function() { | ||
return 'this.'; | ||
}, | ||
|
||
getStepDefinitionInner1: function() { | ||
return '('; | ||
}, | ||
|
||
getStepDefinitionInner2: function() { | ||
return ', function('; | ||
}, | ||
|
||
getStepDefinitionEnd: function() { | ||
return ") {\n // " + this.getStepDefinitionEndComment() + "\n callback.pending();\n});\n"; | ||
}, | ||
}; | ||
|
||
_.extend(JavaScriptSyntax.prototype, Syntax.prototype); | ||
|
||
CoffeeScriptSyntax.prototype = { | ||
getStepDefinitionStart: function() { | ||
return '@'; | ||
}, | ||
|
||
getStepDefinitionInner1: function() { | ||
return ' '; | ||
}, | ||
|
||
getStepDefinitionInner2: function() { | ||
return ', ('; | ||
}, | ||
|
||
getStepDefinitionEnd: function() { | ||
return ") ->\n # " + this.getStepDefinitionEndComment() + "\n callback.pending()\n"; | ||
} | ||
}; | ||
|
||
_.extend(CoffeeScriptSyntax.prototype, Syntax.prototype); | ||
|
||
exports.JavaScript = JavaScriptSyntax; | ||
exports.CoffeeScript = CoffeeScriptSyntax; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.