cucumber 3.0.0.pre.2 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.gitattributes +32 -0
  3. data/.github/ISSUE_TEMPLATE.md +1 -1
  4. data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
  5. data/.rubocop_todo.yml +1 -85
  6. data/.travis.yml +3 -2
  7. data/{History.md → CHANGELOG.md} +77 -13
  8. data/appveyor.yml +2 -1
  9. data/bin/cucumber +2 -1
  10. data/cucumber.gemspec +2 -2
  11. data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +6 -1
  12. data/examples/i18n/bg/features/support/env.rb +6 -1
  13. data/examples/i18n/bg/lib/calculator.rb +2 -1
  14. data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +6 -1
  15. data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +6 -1
  16. data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +6 -1
  17. data/examples/i18n/de/features/step_definitions/calculator_steps.rb +6 -1
  18. data/examples/i18n/el/features/step_definitions/calculator_steps.rb +6 -1
  19. data/examples/i18n/en-lol/features/support/env.rb +6 -2
  20. data/examples/i18n/en/features/step_definitions/calculator_steps.rb +6 -1
  21. data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +6 -1
  22. data/examples/i18n/es/features/step_definitions/calculador_steps.rb +6 -1
  23. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +6 -1
  24. data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +6 -1
  25. data/examples/i18n/fr/features/support/env.rb +6 -1
  26. data/examples/i18n/he/features/step_definitions/calculator_steps.rb +6 -1
  27. data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +6 -1
  28. data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +6 -2
  29. data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +6 -1
  30. data/examples/i18n/id/features/step_definitions/calculator_steps.rb +6 -1
  31. data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +6 -1
  32. data/examples/i18n/ja/features/support/env.rb +6 -1
  33. data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +6 -1
  34. data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +6 -1
  35. data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +6 -1
  36. data/examples/i18n/no/features/support/env.rb +6 -1
  37. data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +6 -1
  38. data/examples/i18n/pl/features/support/env.rb +6 -1
  39. data/examples/i18n/pt/features/support/env.rb +6 -1
  40. data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +6 -1
  41. data/examples/i18n/ru/features/support/env.rb +6 -1
  42. data/examples/i18n/ru/lib/calculator.rb +2 -1
  43. data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +6 -1
  44. data/examples/i18n/sr-Cyrl/features/support/env.rb +6 -1
  45. data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +6 -1
  46. data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +6 -1
  47. data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +6 -1
  48. data/examples/i18n/uk/features/support/env.rb +6 -1
  49. data/examples/i18n/uk/lib/calculator.rb +2 -1
  50. data/examples/i18n/uz/features/support/env.rb +6 -1
  51. data/examples/i18n/uz/lib/calculator.rb +2 -1
  52. data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +6 -1
  53. data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +6 -1
  54. data/examples/sinatra/features/support/env.rb +6 -1
  55. data/examples/tcl/features/support/env.rb +2 -1
  56. data/examples/watir/features/step_definitions/search_steps.rb +4 -3
  57. data/examples/watir/features/support/env.rb +5 -1
  58. data/features/docs/api/listen_for_events.feature +2 -2
  59. data/features/docs/cli/execute_with_tag_filter.feature +4 -2
  60. data/features/docs/defining_steps/ambiguous_steps.feature +89 -0
  61. data/features/docs/events/{test_case_starting_event.feature → test_case_started_event.feature} +3 -3
  62. data/features/docs/events/{test_run_starting_event.feature → test_run_started_event.feature} +5 -5
  63. data/features/docs/events/test_step_finished_event.feature +1 -1
  64. data/features/docs/events/{test_step_starting_event.feature → test_step_started_event.feature} +3 -3
  65. data/features/docs/extending_cucumber/custom_formatter.feature +5 -33
  66. data/features/docs/gherkin/outlines.feature +2 -4
  67. data/features/docs/writing_support_code/parameter_types.feature +12 -18
  68. data/features/lib/step_definitions/iso-8859-1_steps.rb +6 -3
  69. data/features/lib/support/fake_wire_server.rb +9 -1
  70. data/features/lib/support/parameter_types.rb +1 -4
  71. data/gem_tasks/fix_cr_lf.rake +17 -6
  72. data/lib/autotest/cucumber_mixin.rb +1 -1
  73. data/lib/cucumber/cli/configuration.rb +2 -2
  74. data/lib/cucumber/cli/options.rb +62 -41
  75. data/lib/cucumber/cli/profile_loader.rb +1 -1
  76. data/lib/cucumber/configuration.rb +3 -2
  77. data/lib/cucumber/deprecate.rb +2 -2
  78. data/lib/cucumber/events.rb +3 -3
  79. data/lib/cucumber/events/test_case_finished.rb +1 -1
  80. data/lib/cucumber/events/{test_case_starting.rb → test_case_started.rb} +1 -1
  81. data/lib/cucumber/events/{test_run_starting.rb → test_run_started.rb} +1 -1
  82. data/lib/cucumber/events/{test_step_starting.rb → test_step_started.rb} +1 -1
  83. data/lib/cucumber/filters.rb +1 -1
  84. data/lib/cucumber/filters/activate_steps.rb +6 -2
  85. data/lib/cucumber/filters/{broadcast_test_run_starting_event.rb → broadcast_test_run_started_event.rb} +2 -2
  86. data/lib/cucumber/formatter/console.rb +1 -1
  87. data/lib/cucumber/formatter/console_issues.rb +2 -2
  88. data/lib/cucumber/formatter/fail_fast.rb +1 -1
  89. data/lib/cucumber/formatter/html.rb +9 -10
  90. data/lib/cucumber/formatter/html_builder.rb +21 -11
  91. data/lib/cucumber/formatter/io.rb +1 -1
  92. data/lib/cucumber/formatter/json.rb +13 -12
  93. data/lib/cucumber/formatter/junit.rb +7 -7
  94. data/lib/cucumber/formatter/legacy_api/adapter.rb +30 -14
  95. data/lib/cucumber/formatter/legacy_api/ast.rb +10 -2
  96. data/lib/cucumber/formatter/progress.rb +2 -2
  97. data/lib/cucumber/formatter/rerun.rb +1 -1
  98. data/lib/cucumber/formatter/summary.rb +1 -1
  99. data/lib/cucumber/glue/dsl.rb +11 -25
  100. data/lib/cucumber/glue/proto_world.rb +0 -5
  101. data/lib/cucumber/hooks.rb +4 -4
  102. data/lib/cucumber/multiline_argument.rb +3 -11
  103. data/lib/cucumber/multiline_argument/data_table.rb +5 -3
  104. data/lib/cucumber/project_initializer.rb +1 -1
  105. data/lib/cucumber/rake/task.rb +8 -4
  106. data/lib/cucumber/runtime.rb +2 -2
  107. data/lib/cucumber/runtime/support_code.rb +1 -1
  108. data/lib/cucumber/runtime/user_interface.rb +5 -5
  109. data/lib/cucumber/step_match.rb +13 -0
  110. data/lib/cucumber/version +1 -1
  111. data/scripts/{update-history → update-changelog} +14 -11
  112. data/spec/cucumber/cli/configuration_spec.rb +13 -1
  113. data/spec/cucumber/cli/options_spec.rb +1 -1
  114. data/spec/cucumber/filters/activate_steps_spec.rb +4 -4
  115. data/spec/cucumber/formatter/fail_fast_spec.rb +1 -1
  116. data/spec/cucumber/formatter/html_spec.rb +1 -1
  117. data/spec/cucumber/formatter/json_spec.rb +26 -51
  118. data/spec/cucumber/formatter/junit_spec.rb +4 -4
  119. data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +86 -98
  120. data/spec/cucumber/formatter/pretty_spec.rb +0 -13
  121. data/spec/cucumber/glue/snippet_spec.rb +2 -2
  122. data/spec/cucumber/hooks_spec.rb +2 -2
  123. data/spec/cucumber/multiline_argument/data_table_spec.rb +10 -5
  124. data/spec/cucumber/rake/forked_spec.rb +15 -11
  125. data/spec/cucumber/world/pending_spec.rb +1 -1
  126. data/spec/support/standard_step_actions.rb +1 -1
  127. metadata +25 -25
  128. data/features/docs/formatters/formatter_step_file_colon_line.feature +0 -44
@@ -2,5 +2,6 @@ require 'rubygems'
2
2
  require 'tcl'
3
3
 
4
4
  Before do
5
- @fib = Tcl::Interp.load_from_file(File.dirname(__FILE__) + '/../../src/fib.tcl')
5
+ file_name = File.dirname(__FILE__) + '/../../src/fib.tcl'
6
+ @fib = Tcl::Interp.load_from_file(file_name)
6
7
  end
@@ -18,9 +18,10 @@ end
18
18
  # consider creating classes for your pages - such as this:
19
19
  # http://github.com/cucumber/cucumber/tree/v0.1.15/examples/watir/features/step_definitons/search_steps.rb
20
20
  #
21
- # You may keep the page classes along your steps, or even better, put them in separate files, e.g.
22
- # support/pages/google_search.rb
21
+ # You may keep the page classes along your steps, or even better, put them in
22
+ # separate files, e.g. support/pages/google_search.rb
23
23
  #
24
24
  # This technique is called "Page Objects", and you can read more about it here:
25
25
  # http://github.com/marekj/watirloo/tree/master
26
- # We're not using this technique here, since we want to illustrate the basics only.
26
+ # We're not using this technique here, since we want to illustrate the
27
+ # basics only.
@@ -1,4 +1,8 @@
1
- begin require 'rspec/expectations'; rescue LoadError; require 'spec/expectations'; end
1
+ begin
2
+ require 'rspec/expectations'
3
+ rescue LoadError
4
+ require 'spec/expectations'
5
+ end
2
6
 
3
7
  browser = nil
4
8
 
@@ -21,7 +21,7 @@ Feature: Listen for events
21
21
  io = config.out_stream
22
22
  config.on_event :step_activated do |event|
23
23
  io.puts "Success!"
24
- io.puts "Step name: #{event.test_step.name}"
24
+ io.puts "Step text: #{event.test_step}"
25
25
  io.puts "Source location: #{event.step_match.location}"
26
26
  end
27
27
  end
@@ -30,7 +30,7 @@ Feature: Listen for events
30
30
  Then it should pass with:
31
31
  """
32
32
  Success!
33
- Step name: matching
33
+ Step text: matching
34
34
  Source location: features/step_definitions/steps.rb:1
35
35
  """
36
36
 
@@ -23,6 +23,7 @@ Feature: Tag logic
23
23
 
24
24
  @ignore
25
25
  Scenario: And yet another Example
26
+ Given passing
26
27
  """
27
28
 
28
29
  Scenario: ANDing tags
@@ -78,9 +79,10 @@ Feature: Tag logic
78
79
 
79
80
  @ignore
80
81
  Scenario: And yet another Example
82
+ Given passing
81
83
 
82
- 2 scenarios (1 undefined, 1 passed)
83
- 1 step (1 undefined)
84
+ 2 scenarios (2 undefined)
85
+ 2 steps (2 undefined)
84
86
  """
85
87
 
86
88
  Scenario: Run with limited tag count, blowing it on scenario
@@ -0,0 +1,89 @@
1
+ Feature: Ambiguous Steps
2
+
3
+ When Cucumber searches for a step definition for a step, it might find multiple step
4
+ definitions that could match. In that case, it will give you an error that the step
5
+ definitions are ambiguous.
6
+
7
+ You can also use a `--guess` mode, where it uses magic powers to try and figure
8
+ out which of those two step definitions is most likely to be the one you meant it
9
+ to use. Use it with caution!
10
+
11
+
12
+ Scenario: Ambiguous steps
13
+
14
+ Given a file named "features/ambiguous.feature" with:
15
+ """
16
+ Feature:
17
+
18
+ Scenario:
19
+ When a step
20
+ Then an ambiguous step
21
+
22
+ """
23
+ And a file named "features/step_definitions.rb" with:
24
+ """
25
+ When(/^a.*step$/) do
26
+ 'foo'
27
+ end
28
+
29
+ Then(/^an ambiguous step$/) do
30
+ 'bar'
31
+ end
32
+
33
+ """
34
+ When I run `cucumber`
35
+ Then it should fail with:
36
+ """
37
+ Ambiguous match of "an ambiguous step":
38
+
39
+ features/step_definitions.rb:1:in `/^a.*step$/'
40
+ features/step_definitions.rb:5:in `/^an ambiguous step$/'
41
+
42
+ You can run again with --guess to make Cucumber be more smart about it
43
+ (Cucumber::Ambiguous)
44
+ features/ambiguous.feature:5:in `Then an ambiguous step'
45
+
46
+ Failing Scenarios:
47
+ cucumber features/ambiguous.feature:3 # Scenario:
48
+
49
+ 1 scenario (1 failed)
50
+ 2 steps (1 failed, 1 passed)
51
+ 0m0.012s
52
+
53
+ """
54
+
55
+
56
+ Scenario: Ambiguous steps with guess mode
57
+
58
+ Given a file named "features/ambiguous.feature" with:
59
+ """
60
+ Feature:
61
+
62
+ Scenario:
63
+ When a step
64
+ Then an ambiguous step
65
+ """
66
+ And a file named "features/step_definitions.rb" with:
67
+ """
68
+ When(/^a.*step$/) do
69
+ 'foo'
70
+ end
71
+
72
+ Then(/^an ambiguous step$/) do
73
+ 'bar'
74
+ end
75
+ """
76
+ When I run `cucumber -g`
77
+ Then it should pass with exactly:
78
+ """
79
+ Feature:
80
+
81
+ Scenario: # features/ambiguous.feature:3
82
+ When a step # features/step_definitions.rb:1
83
+ Then an ambiguous step # features/step_definitions.rb:5
84
+
85
+ 1 scenario (1 passed)
86
+ 2 steps (2 passed)
87
+ 0m0.012s
88
+
89
+ """
@@ -1,10 +1,10 @@
1
1
  @wip
2
- Feature: Test Case Starting Event
2
+ Feature: Test Case Started Event
3
3
 
4
4
  This event is fired just before each scenario or scenario outline example row
5
5
  (generally named a Test Case) starts to be executed. This event is read-only.
6
6
 
7
- See [the API documentation](http://www.rubydoc.info/github/cucumber/cucumber-ruby/Cucumber/Events/TestCaseStarting) for more information about the data available on this event and the result object.
7
+ See [the API documentation](http://www.rubydoc.info/github/cucumber/cucumber-ruby/Cucumber/Events/TestCaseStarted) for more information about the data available on this event and the result object.
8
8
 
9
9
  Background:
10
10
  Given the standard step definitions
@@ -22,7 +22,7 @@ Feature: Test Case Starting Event
22
22
  stdout = nil
23
23
  AfterConfiguration do |config|
24
24
  stdout = config.out_stream # make sure all the `puts` calls can write to the same output
25
- config.on_event :test_case_starting do |event|
25
+ config.on_event :test_case_started do |event|
26
26
  stdout.puts "before"
27
27
  stdout.puts event.test_case.tags.map(&:name)
28
28
  end
@@ -1,9 +1,9 @@
1
- Feature: Test Run Starting Event
1
+ Feature: Test Run Started Event
2
2
 
3
3
  This event is fired once all test cases have been filtered, just before
4
4
  the first one is executed.
5
5
 
6
- See [the API documentation](http://www.rubydoc.info/github/cucumber/cucumber-ruby/Cucumber/Events/TestRunStarting) for more information about the data available on this event.
6
+ See [the API documentation](http://www.rubydoc.info/github/cucumber/cucumber-ruby/Cucumber/Events/TestRunStarted) for more information about the data available on this event.
7
7
 
8
8
  Background:
9
9
  Given the standard step definitions
@@ -22,8 +22,8 @@ Feature: Test Run Starting Event
22
22
  And a file named "features/support/events.rb" with:
23
23
  """
24
24
  AfterConfiguration do |config|
25
- config.on_event :test_run_starting do |event|
26
- config.out_stream.puts "test run starting"
25
+ config.on_event :test_run_started do |event|
26
+ config.out_stream.puts "test run started"
27
27
  config.out_stream.puts event.test_cases.map(&:location)
28
28
  end
29
29
  end
@@ -34,7 +34,7 @@ Feature: Test Run Starting Event
34
34
  When I run `cucumber -q`
35
35
  Then it should pass with:
36
36
  """
37
- test run starting
37
+ test run started
38
38
  features/bar.feature:2
39
39
  features/foo.feature:2
40
40
  """
@@ -24,7 +24,7 @@ Feature: Test Step Finished Event
24
24
  """
25
25
  AfterConfiguration do |config|
26
26
  config.on_event :test_step_finished do |event|
27
- config.out_stream.puts "Test step: #{event.test_step.name}"
27
+ config.out_stream.puts "Test step: #{event.test_step}"
28
28
  config.out_stream.puts "The result is: #{event.result}"
29
29
  end
30
30
  end
@@ -1,11 +1,11 @@
1
- Feature: Test Step Starting Event
1
+ Feature: Test Step Started Event
2
2
 
3
3
  This event is fired just before each step in a scenario or scenario outline example
4
4
  (generally named a Test Step) starts to be executed. This event is read-only, so there
5
5
  is no way to prevent the test step from running, but you can use it for logging or user
6
6
  notification.
7
7
 
8
- See [the API documentation](http://www.rubydoc.info/github/cucumber/cucumber-ruby/Cucumber/Events/TestStepStarting) for more information about the data available on this event and the result object.
8
+ See [the API documentation](http://www.rubydoc.info/github/cucumber/cucumber-ruby/Cucumber/Events/TestStepStarted) for more information about the data available on this event and the result object.
9
9
 
10
10
  Background:
11
11
  Given the standard step definitions
@@ -21,7 +21,7 @@ Feature: Test Step Starting Event
21
21
  stdout = nil
22
22
  AfterConfiguration do |config|
23
23
  stdout = config.out_stream # make sure all the `puts` calls can write to the same output
24
- config.on_event :test_step_starting do |event|
24
+ config.on_event :test_step_started do |event|
25
25
  stdout.puts "before"
26
26
  end
27
27
  config.on_event :test_step_finished do |event|
@@ -19,7 +19,7 @@ Feature: Custom Formatter
19
19
  class Formatter
20
20
  def initialize(config)
21
21
  @io = config.out_stream
22
- config.on_event :test_case_starting do |event|
22
+ config.on_event :test_case_started do |event|
23
23
  print_test_case_name(event.test_case)
24
24
  end
25
25
  end
@@ -41,7 +41,7 @@ Feature: Custom Formatter
41
41
 
42
42
  """
43
43
 
44
- Scenario: Custom config
44
+ Scenario: Pass custom config to your formatter from the CLI
45
45
  Given a file named "features/support/custom_formatter.rb" with:
46
46
  """
47
47
  module MyCustom
@@ -61,7 +61,7 @@ Feature: Custom Formatter
61
61
  {"foo"=>"bar", "one"=>"two"}
62
62
  """
63
63
 
64
- Scenario: Use the legacy API
64
+ Scenario: Use the legacy API
65
65
  This is deprecated and should no longer be used.
66
66
 
67
67
  Given a file named "features/support/custom_legacy_formatter.rb" with:
@@ -85,38 +85,10 @@ Feature: Custom Formatter
85
85
  When I run `cucumber features/f.feature --format MyCustom::LegacyFormatter`
86
86
  Then it should pass with exactly:
87
87
  """
88
- I'LL USE MY OWN
89
- JUST PRINT ME
90
-
91
- """
88
+ WARNING: The formatter MyCustom::LegacyFormatter is using the deprecated formatter API which will be removed in v4.0 of Cucumber.
92
89
 
93
- Scenario: Use both old and new
94
- You can both APIs at once, for now
95
-
96
- Given a file named "features/support/custom_mixed_formatter.rb" with:
97
- """
98
- module MyCustom
99
- class MixedFormatter
100
-
101
- def initialize(runtime, io, options)
102
- @io = io
103
- end
104
-
105
- def before_test_case(test_case)
106
- feature = test_case.source.first
107
- @io.puts feature.short_name.upcase
108
- end
109
-
110
- def scenario_name(keyword, name, file_colon_line, source_indent)
111
- @io.puts " #{name.upcase}"
112
- end
113
- end
114
- end
115
- """
116
- When I run `cucumber features/f.feature --format MyCustom::MixedFormatter`
117
- Then it should pass with exactly:
118
- """
119
90
  I'LL USE MY OWN
120
91
  JUST PRINT ME
121
92
 
122
93
  """
94
+
@@ -50,8 +50,6 @@ Feature: Scenario outlines
50
50
  """
51
51
  Feature: Outline Sample
52
52
 
53
- Scenario: I have no steps
54
-
55
53
  Scenario Outline: Test state
56
54
  Given <state> without a table
57
55
  Given <other_state> without a table
@@ -73,7 +71,7 @@ Feature: Scenario outlines
73
71
  Failing Scenarios:
74
72
  cucumber features/outline_sample.feature:12
75
73
 
76
- 5 scenarios (1 failed, 1 undefined, 3 passed)
74
+ 4 scenarios (1 failed, 1 undefined, 2 passed)
77
75
  8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
78
76
  """
79
77
 
@@ -154,7 +152,7 @@ Feature: Scenario outlines
154
152
  Failing Scenarios:
155
153
  cucumber features/outline_sample.feature:12
156
154
 
157
- 5 scenarios (1 failed, 1 undefined, 3 passed)
155
+ 4 scenarios (1 failed, 1 undefined, 2 passed)
158
156
  8 steps (1 failed, 2 skipped, 1 undefined, 4 passed)
159
157
 
160
158
  """
@@ -46,30 +46,24 @@ Feature: Parameter Types
46
46
  ParameterType(
47
47
  name: 'person',
48
48
  regexp: /[A-Z]\w+/,
49
- type: Person,
50
- transformer: lambda do |name|
51
- Person.new(name)
52
- end,
53
- use_for_snippets: true,
54
- prefer_for_regexp_match: false
49
+ transformer: -> (name) { Person.new(name) }
55
50
  )
56
51
  """
57
52
  When I run `cucumber features/foo.feature`
58
53
  Then it should pass
59
54
 
60
- Scenario: Parameter type defined with legacy Transform method
61
- This is for backwards compatibility - works with regular expressions,
62
- but not with Cucumber Expressions, because no name is specified for the
63
- parameter type.
55
+ Scenario: Parameter type defined with ParameterType method
56
+ If your parameter type's `regexp` is very general, you can tell
57
+ Cucumber not to suggest its use in snippets:
64
58
 
65
- Given a file named "features/support/transforms.rb" with:
59
+ Given a file named "features/support/parameter_types.rb" with:
66
60
  """
67
- Transform(/[A-Z]\w+/) do |name|
68
- Person.new(name)
69
- end
61
+ ParameterType(
62
+ name: 'person',
63
+ regexp: /[A-Z]\w+/,
64
+ transformer: -> (name) { Person.new(name) },
65
+ use_for_snippets: false
66
+ )
70
67
  """
71
68
  When I run `cucumber features/foo.feature`
72
- Then it should fail with:
73
- """
74
- Undefined parameter type {person}
75
- """
69
+ Then it should pass
@@ -1,9 +1,12 @@
1
1
  # encoding: iso-8859-1
2
2
  # frozen_string_literal: true
3
- # Ideally we would use Norwegian keywords here, but that won't work unless this file is UTF-8 encoded.
4
- # Alternatively it would be possible to use Norwegian keywords and encode the file as UTF-8.
3
+ # Ideally we would use Norwegian keywords here, but that won't work unless this
4
+ # file is UTF-8 encoded.
5
+ # Alternatively, it would be possible to use Norwegian keywords and encode the
6
+ # file as UTF-8.
5
7
  #
6
- # In both cases, stepdef arguments will be sent in as UTF-8, regardless of what encoding is used.
8
+ # In both cases, stepdef arguments will be sent in as UTF-8, regardless of what
9
+ # encoding is used.
7
10
  Given(/^jeg drikker en "([^"]*)"$/) do |drink|
8
11
  expect(drink).to eq '�l'.encode('UTF-8')
9
12
  end
@@ -65,7 +65,15 @@ class FakeWireServer
65
65
  send_response(['fail', serialized_exception ].to_json)
66
66
  end
67
67
  rescue => e
68
- send_response(['fail', { :message => e.message, :backtrace => e.backtrace, :exception => e.class } ].to_json)
68
+ response = [
69
+ 'fail',
70
+ {
71
+ :message => e.message,
72
+ :backtrace => e.backtrace,
73
+ :exception => e.class
74
+ }
75
+ ].to_json
76
+ send_response(response)
69
77
  end
70
78
 
71
79
  def response_to(data)
@@ -1,8 +1,5 @@
1
1
  ParameterType(
2
2
  name: 'list',
3
3
  regexp: /.*/,
4
- type: Array,
5
- transformer: ->(s) { s.split(/,\s+/)},
6
- use_for_snippets: false,
7
- prefer_for_regexp_match: false
4
+ transformer: ->(s) { s.split(/,\s+/)}
8
5
  )
@@ -1,11 +1,22 @@
1
1
  # frozen_string_literal: true
2
+
3
+ require 'pathname'
4
+
2
5
  desc 'Make all files use UNIX (\n) line endings'
3
6
  task :fix_cr_lf do
4
- files = FileList['**/*']
5
- files.each do |f|
6
- next if File.directory?(f) || f =~ /dos/
7
- s = IO.read(f)
8
- s.gsub!(/\r?\n/, "\n")
9
- File.open(f, 'w') { |io| io.write(s) }
7
+ iso_8859_1_files = FileList.new(
8
+ 'features/docs/iso-8859-1.feature',
9
+ 'features/lib/step_definitions/iso-8859-1_steps.rb'
10
+ )
11
+
12
+ utf8_files = FileList.new('**/*') do |fl|
13
+ fl.exclude { |f| File.directory?(f) }
14
+ end
15
+
16
+ paths = (utf8_files - iso_8859_1_files).map { |f| Pathname(f) }
17
+
18
+ paths.each do |path|
19
+ content = path.read.gsub(/\r?\n/, "\n")
20
+ path.write(content)
10
21
  end
11
22
  end