Skip to content
This repository was archived by the owner on Feb 5, 2024. It is now read-only.

Commit 4b24a82

Browse files
committed
Minor change to stepdef snippets (JS)
1 parent cb3b0ad commit 4b24a82

File tree

3 files changed

+61
-61
lines changed

3 files changed

+61
-61
lines changed

features/step_definitions/cucumber_js_mappings.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ def write_failing_mapping_with_message(step_name, message)
5959
end
6060

6161
def write_asynchronously_failing_mapping_with_message(step_name, message)
62-
append_step_definition(step_name, "setTimeout(function() { callback.fail('#{message}');}, 10);")
62+
append_step_definition(step_name, "setTimeout(function () { callback.fail('#{message}');}, 10);")
6363
end
6464

6565
def write_asynchronously_failing_mapping_through_exception_with_message(step_name, message)
66-
append_step_definition(step_name, "setTimeout(function() { throw new Error('#{message}');}, 10);")
66+
append_step_definition(step_name, "setTimeout(function () { throw new Error('#{message}');}, 10);")
6767
end
6868

6969
def write_failing_mapping_through_nodejs_callback(step_name)
@@ -83,7 +83,7 @@ def write_mapping_logging_world_variable_value(step_name, time = "1")
8383

8484
def write_mapping_calling_world_function(step_name)
8585
step_def = <<-EOF
86-
this.someFunction(); callback();
86+
this.someFunction (); callback();
8787
EOF
8888
append_step_definition(step_name, step_def)
8989
end
@@ -147,14 +147,14 @@ def write_custom_world_constructor
147147
def write_custom_world_constructor_calling_back_with_explicit_object
148148
append_support_code "this.World = function CustomWorldConstructor(callback) {
149149
callback({
150-
someFunction: function() { fs.writeFileSync(\"#{EXPLICIT_WORLD_OBJECT_FUNCTION_LOG_FILE}\", \"\")}
150+
someFunction: function () { fs.writeFileSync(\"#{EXPLICIT_WORLD_OBJECT_FUNCTION_LOG_FILE}\", \"\")}
151151
});
152152
};\n"
153153
end
154154

155155
def write_world_function
156156
append_support_code <<-EOF
157-
this.World.prototype.someFunction = function() {
157+
this.World.prototype.someFunction = function () {
158158
fs.writeFileSync("#{WORLD_FUNCTION_LOG_FILE}", "");
159159
};
160160
EOF
@@ -176,17 +176,17 @@ def write_passing_hook options = {}
176176

177177
if hook_type == "around"
178178
append_support_code <<-EOF
179-
this.#{define_hook}(#{params}function(scenario, runScenario) {
179+
this.#{define_hook}(#{params}function (scenario, runScenario) {
180180
this.logCycleEvent('#{log_string}-pre');
181-
runScenario(function(callback) {
181+
runScenario(function (callback) {
182182
this.logCycleEvent('#{log_string}-post');
183183
callback();
184184
});
185185
});
186186
EOF
187187
else
188188
append_support_code <<-EOF
189-
this.#{define_hook}(#{params}function(scenario, callback) {
189+
this.#{define_hook}(#{params}function (scenario, callback) {
190190
this.logCycleEvent('#{log_string}');
191191
callback();
192192
});
@@ -296,7 +296,7 @@ def assert_suggested_step_definition_snippet(stepdef_keyword, stepdef_pattern, p
296296
params << "callback"
297297
params = params.join ", "
298298
expected_snippet = <<-EOF
299-
this.#{stepdef_keyword}(/#{stepdef_pattern}/, function(#{params}) {
299+
this.#{stepdef_keyword}(/#{stepdef_pattern}/, function (#{params}) {
300300
// express the regexp above with the code you wish you had
301301
callback.pending();
302302
});
@@ -340,7 +340,7 @@ def append_step_definition(step_name, code, params = [])
340340
params_string = params.join(", ")
341341
indented_code = indent_code(code).rstrip
342342
append_support_code <<-EOF
343-
this.defineStep(/#{step_name}/, function(#{params_string}) {
343+
this.defineStep(/#{step_name}/, function (#{params_string}) {
344344
fs.writeFileSync("#{step_file(step_name)}", "");
345345
#{indented_code}
346346
});
@@ -353,7 +353,7 @@ def append_support_code(code)
353353
end
354354

355355
def write_main_step_definitions_file
356-
append_to_file(STEP_DEFINITIONS_FILE, "var fs = require('fs');\nvar stepDefinitions = function() {\n");
356+
append_to_file(STEP_DEFINITIONS_FILE, "var fs = require('fs');\nvar stepDefinitions = function () {\n");
357357
append_to_file(STEP_DEFINITIONS_FILE, support_code);
358358
append_to_file(STEP_DEFINITIONS_FILE, "};\nmodule.exports = stepDefinitions;")
359359
end
@@ -370,7 +370,7 @@ def write_coffee_script_definition_file
370370
module.exports = stepDefinitions
371371
EOF
372372
end
373-
373+
374374
def write_pogo_script_definition_file
375375
@mapping_name = "a PogoScript mapping"
376376
append_to_file POGO_SCRIPT_DEFINITIONS_FILE, <<-EOF
@@ -379,15 +379,15 @@ def write_pogo_script_definition_file
379379
this.define step r/^#{@mapping_name}$/ @(callback)
380380
fs.write file sync ('#{step_file(@mapping_name)}', '')
381381
callback()
382-
382+
383383
module.exports = step definitions
384384
EOF
385385
end
386386

387387
def write_string_based_pattern_mapping
388388
@mapping_name = "a mapping + fancy characters"
389389
append_support_code <<-EOF
390-
this.defineStep("a mapping + fancy characters", function(callback) {
390+
this.defineStep("a mapping + fancy characters", function (callback) {
391391
fs.writeFileSync("#{step_file(@mapping_name)}", "");
392392
callback();
393393
});
@@ -397,7 +397,7 @@ def write_string_based_pattern_mapping
397397
def write_string_based_pattern_mapping_with_parameters
398398
@mapping_name = "a string-based mapping with parameters"
399399
append_support_code <<-EOF
400-
this.defineStep('a mapping with $word_param "$multi_word_param"', function(p1, p2, callback) {
400+
this.defineStep('a mapping with $word_param "$multi_word_param"', function (p1, p2, callback) {
401401
fs.writeFileSync("#{step_file(@mapping_name)}", p1 + "\\n" + p2);
402402
callback();
403403
});

lib/cucumber/support_code/step_definition_snippet_builder_syntax.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ JavaScriptSyntax.prototype = {
6363
},
6464

6565
getStepDefinitionInner2: function() {
66-
return ', function(';
66+
return ', function (';
6767
},
6868

6969
getStepDefinitionEnd: function() {
@@ -94,4 +94,4 @@ CoffeeScriptSyntax.prototype = {
9494
_.extend(CoffeeScriptSyntax.prototype, Syntax.prototype);
9595

9696
exports.JavaScript = JavaScriptSyntax;
97-
exports.CoffeeScript = CoffeeScriptSyntax;
97+
exports.CoffeeScript = CoffeeScriptSyntax;

spec/cucumber/support_code/step_definition_snippet_builder_syntax_spec.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,143 @@
11
require('../../support/spec_helper');
22

3-
describe('Cucumber.SupportCode.StepDefinitionSnippetBuilderSyntax', function() {
3+
describe('Cucumber.SupportCode.StepDefinitionSnippetBuilderSyntax', function () {
44
var Cucumber = requireLib('cucumber');
55
var Syntax = Cucumber.SupportCode.StepDefinitionSnippetBuilderSyntax;
66
var stepDefinitionEndComment = 'express the regexp above with the code you wish you had';
77

88
function testBaseSyntax(syntax) {
99

10-
describe('getStepDefinitionDocString()', function() {
11-
it('returns "string"', function() {
10+
describe('getStepDefinitionDocString()', function () {
11+
it('returns "string"', function () {
1212
expect(syntax.getStepDefinitionDocString()).toBe('string');
1313
});
1414
});
1515

16-
describe('getStepDefinitionDataTable()', function() {
17-
it('returns "table"', function() {
16+
describe('getStepDefinitionDataTable()', function () {
17+
it('returns "table"', function () {
1818
expect(syntax.getStepDefinitionDataTable()).toBe('table');
1919
});
2020
});
2121

22-
describe('getStepDefinitionCallback()', function() {
23-
it('returns "callback"', function() {
22+
describe('getStepDefinitionCallback()', function () {
23+
it('returns "callback"', function () {
2424
expect(syntax.getStepDefinitionCallback()).toBe('callback');
2525
});
2626
});
2727

28-
describe('getPatternStart()', function() {
29-
it('returns "/^"', function() {
28+
describe('getPatternStart()', function () {
29+
it('returns "/^"', function () {
3030
expect(syntax.getPatternStart()).toBe('/^');
3131
});
3232
});
3333

34-
describe('getPatternEnd()', function() {
35-
it('returns "$/"', function() {
34+
describe('getPatternEnd()', function () {
35+
it('returns "$/"', function () {
3636
expect(syntax.getPatternEnd()).toBe('$/');
3737
});
3838
});
3939

40-
describe('getContextStepDefinitionFunctionName()', function() {
41-
it('returns "Given"', function() {
40+
describe('getContextStepDefinitionFunctionName()', function () {
41+
it('returns "Given"', function () {
4242
expect(syntax.getContextStepDefinitionFunctionName()).toBe('Given');
4343
});
4444
});
4545

46-
describe('getEventStepDefinitionFunctionName()', function() {
47-
it('returns "When"', function() {
46+
describe('getEventStepDefinitionFunctionName()', function () {
47+
it('returns "When"', function () {
4848
expect(syntax.getEventStepDefinitionFunctionName()).toBe('When');
4949
});
5050
});
5151

52-
describe('getOutcomeStepDefinitionFunctionName()', function() {
53-
it('returns "Then"', function() {
52+
describe('getOutcomeStepDefinitionFunctionName()', function () {
53+
it('returns "Then"', function () {
5454
expect(syntax.getOutcomeStepDefinitionFunctionName()).toBe('Then');
5555
});
5656
});
5757

58-
describe('getNumberMatchingGroup()', function() {
59-
it('returns (\\d+)', function() {
58+
describe('getNumberMatchingGroup()', function () {
59+
it('returns (\\d+)', function () {
6060
expect(syntax.getNumberMatchingGroup()).toBe('(\\d+)');
6161
});
6262
});
6363

64-
describe('getQuotedStringMatchingGroup()', function() {
65-
it('returns "([^"]*)"', function() {
64+
describe('getQuotedStringMatchingGroup()', function () {
65+
it('returns "([^"]*)"', function () {
6666
expect(syntax.getQuotedStringMatchingGroup()).toBe('"([^"]*)"');
6767
});
6868
});
6969

70-
describe('getFunctionParameterSeparator()', function() {
71-
it('returns ", "', function() {
70+
describe('getFunctionParameterSeparator()', function () {
71+
it('returns ", "', function () {
7272
expect(syntax.getFunctionParameterSeparator()).toBe(', ');
7373
});
7474
});
7575

76-
describe('getStepDefinitionEndComment()', function() {
77-
it('returns "' + stepDefinitionEndComment + '"', function() {
76+
describe('getStepDefinitionEndComment()', function () {
77+
it('returns "' + stepDefinitionEndComment + '"', function () {
7878
expect(syntax.getStepDefinitionEndComment()).toBe(stepDefinitionEndComment);
7979
});
8080
});
8181

8282
}
8383

84-
describe('JavaScript', function() {
84+
describe('JavaScript', function () {
8585
var syntax = new Syntax.JavaScript();
8686

8787
testBaseSyntax(syntax);
8888

89-
describe('getStepDefinitionStart()', function() {
90-
it('returns "this."', function() {
89+
describe('getStepDefinitionStart()', function () {
90+
it('returns "this."', function () {
9191
expect(syntax.getStepDefinitionStart()).toBe('this.');
9292
});
9393
});
9494

95-
describe('getStepDefinitionInner1()', function() {
96-
it('returns "("', function() {
95+
describe('getStepDefinitionInner1()', function () {
96+
it('returns "("', function () {
9797
expect(syntax.getStepDefinitionInner1()).toBe('(');
9898
});
9999
});
100100

101-
describe('getStepDefinitionInner2()', function() {
102-
it('returns ", function("', function() {
103-
expect(syntax.getStepDefinitionInner2()).toBe(', function(');
101+
describe('getStepDefinitionInner2()', function () {
102+
it('returns ", function ("', function () {
103+
expect(syntax.getStepDefinitionInner2()).toBe(', function (');
104104
});
105105
});
106106

107-
describe('getStepDefinitionEnd()', function() {
107+
describe('getStepDefinitionEnd()', function () {
108108
var str = ") {\n // " + stepDefinitionEndComment + "\n callback.pending();\n});\n";
109-
it('returns "' + str + '"', function() {
109+
it('returns "' + str + '"', function () {
110110
expect(syntax.getStepDefinitionEnd()).toBe(str);
111111
});
112112
});
113113
});
114114

115-
describe('CoffeeScipt', function() {
115+
describe('CoffeeScipt', function () {
116116
var syntax = new Syntax.CoffeeScript();
117117

118118
testBaseSyntax(syntax);
119119

120-
describe('getStepDefinitionStart()', function() {
121-
it('returns "@"', function() {
120+
describe('getStepDefinitionStart()', function () {
121+
it('returns "@"', function () {
122122
expect(syntax.getStepDefinitionStart()).toBe('@');
123123
});
124124
});
125125

126-
describe('getStepDefinitioninner1()', function() {
127-
it('returns " "', function() {
126+
describe('getStepDefinitioninner1()', function () {
127+
it('returns " "', function () {
128128
expect(syntax.getStepDefinitionInner1()).toBe(' ');
129129
});
130130
});
131131

132-
describe('getStepDefinitionInner2()', function() {
133-
it('returns ", ("', function() {
132+
describe('getStepDefinitionInner2()', function () {
133+
it('returns ", ("', function () {
134134
expect(syntax.getStepDefinitionInner2()).toBe(', (');
135135
});
136136
});
137137

138-
describe('getStepDefinitionEnd()', function() {
138+
describe('getStepDefinitionEnd()', function () {
139139
var str = ") ->\n # " + stepDefinitionEndComment + "\n callback.pending()\n";
140-
it('returns "' + str + '"', function() {
140+
it('returns "' + str + '"', function () {
141141
expect(syntax.getStepDefinitionEnd()).toBe(str);
142142
});
143143
});

0 commit comments

Comments
 (0)