cucumber 4.0.0.rc.1 → 4.0.0.rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 272094a2efb99945d2d0e3e6a91bae0b855428d0
4
- data.tar.gz: 400106f2e8a065a57bb9d85171b5fa7e98999d3a
2
+ SHA256:
3
+ metadata.gz: ee911dfd2e4141ad61af0c67b5c9be6e169fe2d27bd2a9c407a590fe9eb0e72a
4
+ data.tar.gz: 28fd680ef1f6f8d60bbcaba4a44c153d94d0a626c873aac9956b7ee8b36e8c7b
5
5
  SHA512:
6
- metadata.gz: 7e4c314d1e1b30f1d8e5ef171a7fb5ca1120bd9cd9c2ec2f1e353f7ee38d74ddc04771a8506c62ef4e71c9b58aeb6f28dccd3d2d979f2119dcc10b30c2ca7d2e
7
- data.tar.gz: 854f93e0396ebc737e6f5f525028654042b96387b90c12ae7b41f65cd76e03668cf50c9a0a9517455f080a76b5c21a4825b3fe2f51b353471a91e45f47cb5139
6
+ metadata.gz: 75974422135d45e115c32f685e88971eeec3f1c13473a0fc312412c4f73b665e84d439840642c67b93076a7499cf0130e28caddbb6761e5780b8e29b66e767eb
7
+ data.tar.gz: d0eebdfd398decebf6fd0982306f31d501794bb8c5866452e0e65354a3af10da9d50c49cd08a137ec87193902cc2934e70340bed5a41b23ee59f84191c66add8
@@ -10,22 +10,60 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
10
10
 
11
11
  ----
12
12
 
13
- ## [In Git](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.1...master) (Not released)
13
+ ## [4.0.0.rc.2](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.2...v4.0.0.rc.3)
14
+
15
+ ### Changed
16
+
17
+ * Update to cucumber-wire 1.1.
18
+
19
+
20
+ ## [4.0.0.rc.2](https://github.com/cucumber/cucumber-ruby/compare/v4.0.0.rc.1...v4.0.0.rc.2)
14
21
 
15
22
  ### Added
23
+ * There is a new methodology in Cucumber for how the auto-loader works
24
+ * The old `load` behaviour is now replaced with a newer `require` behaviour
25
+ * Cucumber will (From version 4), now auto-load files using the `require` method
26
+ * If you wish to alter this, then you can set a top level config option: `Cucumber.use_legacy_autoloader`
27
+ * Like most config options, setting this inside a `spec_helper.rb` or `env.rb` file is advised
28
+ * For more information on this change, including why it was made. Please read this
29
+ [Blog Post](www.google.com)
30
+ ([#1349](https://github.com/cucumber/cucumber-ruby/pull/1349),
31
+ [#1043](https://github.com/cucumber/cucumber-ruby/issues/1043)
32
+ [luke-hill](https://github.com/luke-hill))
16
33
 
17
34
  ### Changed
18
-
19
- ### Deprecated
35
+ * Going forward the minimum ruby version for all cucumber based gems is 2.3
36
+ ([luke-hill](https://github.com/luke-hill))
20
37
 
21
38
  ### Removed
39
+ * Removed Travis publish job for cucumber-pro(a.k.a. jam)
40
+ ([#1350](https://github.com/cucumber/cucumber-ruby/pull/1350)
41
+ [luke-hill](https://github.com/luke-hill))
42
+
43
+ * Drop support for JRuby. We may add this back if new versions of protobuf for JRuby
44
+ start working, or if someone can make the build pass with an older version.
45
+ All this means is we're ok to make releases while the jruby CI job is failing.
46
+
47
+ ([aslakhellesoy](https://github.com/aslakhellesoy))
48
+
49
+ * Remove `dots-formatter introduced in `4.0.0rc1`
22
50
 
23
51
  ### Fixed
24
52
 
25
- ### Added
53
+ * Fix the placeholder expansions in the json formatter
54
+ ([#1361](https://github.com/cucumber/cucumber-ruby/pull/1361)
55
+ [brasmusson](https://github.com/brasmusson))
56
+ * Fix seed printed in cucumber UI to match the seed that was actually used.
57
+ ([#1329](https://github.com/cucumber/cucumber-ruby/pull/1329)
58
+ [deivid-rodriguez](https://github.com/deivid-rodriguez))
59
+ * Make SIGINT/`Ctrl+c` behavior consistent with SIGTERM/`kill` behavior - now first invocation causes existing scenario to stop running and jump to `at_exit`, second invocation causes immediate exit. Before that first invocation only instructed Cucumber to exit after scenario and second invocation caused immediate exit skipping `at_exit`.
60
+ ([#1353](https://github.com/cucumber/cucumber-ruby/pull/1353)
61
+ [akostadinov](https://github.com/akostadinov))
26
62
 
27
63
  ### Improved
28
64
 
65
+ * Filter out any lines containing `site_ruby` from stacktrace
66
+
29
67
  ## [4.0.0.rc.1](https://github.com/cucumber/cucumber-ruby/compare/v3.1.2...v4.0.0.rc.1) (2018-09-29)
30
68
 
31
69
  ### Added
@@ -50,6 +88,7 @@ Please visit [cucumber/CONTRIBUTING.md](https://github.com/cucumber/cucumber/blo
50
88
  * Let the Pretty Formatter use events.
51
89
  ([#1305](https://github.com/cucumber/cucumber-ruby/pull/1305)
52
90
  [brasmusson](https://github.com/brasmusson))
91
+ * Use single quotes in generated template steps ([#1323](https://github.com/cucumber/cucumber-ruby/pull/1323) [acant](https://github.com/acant))
53
92
 
54
93
  ### Removed
55
94
 
@@ -675,7 +714,7 @@ all.
675
714
  * Upgrade Gherkin version to remove warnings when running on JRuby. ([#393](https://github.com/cucumber/cucumber-ruby/issues/393) Oleg Sukhodolsky)
676
715
  * Do not use TagExpression.eval() which is deprecated in Gherkin 2.11.7 ([#420](https://github.com/cucumber/cucumber-ruby/issues/420) Oleg Sukhodolsky)
677
716
 
678
- ## 1.2.4
717
+ ## 1.2.4
679
718
 
680
719
  Yanked. See ([#428](https://github.com/cucumber/cucumber-ruby/issues/428)).
681
720
 
@@ -55,7 +55,7 @@ gem 'byebug'
55
55
  If you are new to the project or to OSS, check the label
56
56
  [Easy](https://github.com/cucumber/cucumber-ruby/labels/Easy). Also, you can
57
57
  help us to correct style violations reported here:
58
- [.rubocop_todo.yaml](https://github.com/cucumber/cucumber-ruby/blob/master/.rubocop_todo.yml).
58
+ [.rubocop_todo.yml](https://github.com/cucumber/cucumber-ruby/blob/master/.rubocop_todo.yml).
59
59
 
60
60
  ## Release Process
61
61
 
@@ -69,20 +69,3 @@ Now release it
69
69
  git commit -m "Release X.Y.Z"
70
70
  # Make sure you run gem signin as the cukebot@cucumber.io user before running the following step. Credentials can be found in 1Password
71
71
  rake release
72
-
73
- ## Gaining Release Karma
74
-
75
- To become a release manager, create a pull request adding your name to the list below, and include your Rubygems email address in the ticket. One of the existing Release managers will then add you.
76
-
77
- Current release managers:
78
- * [Matt Wynne](https://rubygems.org/profiles/mattwynne)
79
- * [Aslak Hellesøy](https://rubygems.org/profiles/aslakhellesoy)
80
- * [Oleg Sukhodolsky](https://rubygems.org/profiles/os97673)
81
- * [Steve Tooke](https://rubygems.org/profiles/tooky)
82
- * [Björn Rasmusson](https://rubygems.org/profiles/brasmusson)
83
- * [Andrew Walter](https://rubygems.org/profiles/xtrasimplicity)
84
-
85
- To grant release karma, issue the following commands:
86
-
87
- gem owner cucumber --add <NEW OWNER RUBYGEMS EMAIL>
88
- gem owner cucumber-core --add <NEW OWNER RUBYGEMS EMAIL>
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
 
6
6
  [![Code Climate](https://codeclimate.com/github/cucumber/cucumber-ruby.svg)](https://codeclimate.com/github/cucumber/cucumber-ruby)
7
7
  [![Coverage Status](https://coveralls.io/repos/cucumber/cucumber-ruby/badge.svg?branch=master)](https://coveralls.io/r/cucumber/cucumber-ruby?branch=master)
8
- [![Dependency Status](https://gemnasium.com/cucumber/cucumber-ruby.svg)](https://gemnasium.com/cucumber/cucumber-ruby)
9
8
 
10
9
  # Cucumber
11
10
 
@@ -17,7 +16,7 @@ your team.
17
16
  Where to get more info:
18
17
 
19
18
  * The main website: https://cucumber.io/
20
- * Documentation: https://docs.cucumber.io
19
+ * Documentation: https://cucumber.io/docs
21
20
  * Ruby API Documentation: http://www.rubydoc.info/github/cucumber/cucumber-ruby/
22
21
  * Support forum: https://groups.google.com/group/cukes
23
22
  * Chat: ([Slack](https://cucumber.io/support#slack) and [Gitter](https://cucumber.io/support#gitter))
@@ -25,10 +24,10 @@ Where to get more info:
25
24
  See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber.
26
25
 
27
26
  ## Supported platforms
27
+ * Ruby 2.6
28
28
  * Ruby 2.5
29
29
  * Ruby 2.4
30
30
  * Ruby 2.3
31
- * Ruby 2.2
32
31
  * JRuby 9.1
33
32
 
34
33
  ## Code of Conduct
@@ -80,10 +80,10 @@ module Autotest::CucumberMixin
80
80
  open("| #{cmd}", 'r') do |f| # rubocop:disable Security/Open
81
81
  until f.eof?
82
82
  c = f.getc || break
83
- put_command(c)
83
+ print(c)
84
84
  line << c
85
85
  next unless c == "\n"
86
- results << join_line
86
+ results << line.join
87
87
  line.clear
88
88
  end
89
89
  end
@@ -96,14 +96,6 @@ module Autotest::CucumberMixin
96
96
  hook :ran_features
97
97
  end
98
98
 
99
- def put_command(cmd)
100
- RUBY_VERSION >= '1.9' ? print(cmd) : putcmd(c)
101
- end
102
-
103
- def join_line
104
- RUBY_VERSION >= '1.9' ? line.join : line.pack('c*')
105
- end
106
-
107
99
  def make_cucumber_cmd(features_to_run, _dirty_features_filename)
108
100
  return '' if features_to_run.empty?
109
101
 
@@ -10,7 +10,7 @@ require 'cucumber/term/ansicolor'
10
10
 
11
11
  module Cucumber
12
12
  class << self
13
- attr_accessor :wants_to_quit
13
+ attr_accessor :wants_to_quit, :use_legacy_autoloader
14
14
 
15
15
  def logger
16
16
  return @log if @log
@@ -108,7 +108,7 @@ module Cucumber
108
108
  end
109
109
 
110
110
  def to_hash
111
- Hash(@options).merge(out_stream: @out_stream, error_stream: @error_stream)
111
+ Hash(@options).merge(out_stream: @out_stream, error_stream: @error_stream, seed: seed)
112
112
  end
113
113
 
114
114
  private
@@ -86,6 +86,7 @@ module Cucumber
86
86
  exit_unable_to_finish! if Cucumber.wants_to_quit
87
87
  Cucumber.wants_to_quit = true
88
88
  STDERR.puts "\nExiting... Interrupt again to exit immediately."
89
+ exit_unable_to_finish
89
90
  end
90
91
  end
91
92
 
@@ -13,7 +13,6 @@ module Cucumber
13
13
  BUILTIN_FORMATS = {
14
14
  'pretty' => ['Cucumber::Formatter::Pretty', 'Prints the feature as is - in colours.'],
15
15
  'progress' => ['Cucumber::Formatter::Progress', 'Prints one character per scenario.'],
16
- 'dots' => ['Cucumber::Formatter::Dots', 'Simple progress output to console'],
17
16
  'rerun' => ['Cucumber::Formatter::Rerun', 'Prints failing files with line numbers.'],
18
17
  'usage' => ['Cucumber::Formatter::Usage', "Prints where step definitions are used.\n" \
19
18
  "#{INDENT}The slowest step definitions (with duration) are\n" \
@@ -189,10 +188,7 @@ Specify SEED to reproduce the shuffling from a previous run.
189
188
  end
190
189
 
191
190
  def dry_run_msg
192
- [
193
- 'Invokes formatters without executing the steps.',
194
- 'This also omits the loading of your support/env.rb file if it exists.'
195
- ]
191
+ ['Invokes formatters without executing the steps.']
196
192
  end
197
193
 
198
194
  def exclude_msg
@@ -309,11 +305,13 @@ Specify SEED to reproduce the shuffling from a previous run.
309
305
  [
310
306
  'Require files before executing the features. If this',
311
307
  'option is not specified, all *.rb files that are',
312
- 'siblings or below the features will be loaded auto-',
308
+ 'siblings of or below the features will be loaded auto-',
313
309
  'matically. Automatic loading is disabled when this',
314
- 'option is specified, and all loading becomes explicit.',
315
- 'Files under directories named "support" are always',
316
- 'loaded first.',
310
+ 'option is specified; all loading becomes explicit.',
311
+ 'Files in directories named "support" are still always',
312
+ 'loaded first when their parent directories are',
313
+ 'required or if the "support" directoires themselves are',
314
+ 'explicitly required.',
317
315
  'This option can be specified multiple times.'
318
316
  ]
319
317
  end
@@ -51,14 +51,29 @@ Defined profiles in cucumber.yml:
51
51
  # Loads the profile, processing it through ERB and YAML, and returns it as a hash.
52
52
  def cucumber_yml
53
53
  return @cucumber_yml if @cucumber_yml
54
- unless cucumber_yml_defined?
55
- raise(ProfilesNotDefinedError, "cucumber.yml was not found. Current directory is #{Dir.pwd}." \
56
- "Please refer to cucumber's documentation on defining profiles in cucumber.yml. You must define" \
57
- "a 'default' profile to use the cucumber command without any arguments.\nType 'cucumber --help' for usage.\n")
54
+
55
+ ensure_configuration_file_exists
56
+ process_configuration_file_with_erb
57
+ load_configuration
58
+
59
+ if @cucumber_yml.nil? || !@cucumber_yml.is_a?(Hash)
60
+ raise(YmlLoadError, 'cucumber.yml was found, but was blank or malformed. ' \
61
+ "Please refer to cucumber's documentation on correct profile usage.\n")
58
62
  end
59
63
 
64
+ @cucumber_yml
65
+ end
66
+
67
+ def ensure_configuration_file_exists
68
+ return if cucumber_yml_defined?
69
+
70
+ raise(ProfilesNotDefinedError, "cucumber.yml was not found. Current directory is #{Dir.pwd}." \
71
+ "Please refer to cucumber's documentation on defining profiles in cucumber.yml. You must define" \
72
+ "a 'default' profile to use the cucumber command without any arguments.\nType 'cucumber --help' for usage.\n")
73
+ end
74
+
75
+ def process_configuration_file_with_erb
60
76
  require 'erb'
61
- require 'yaml'
62
77
  begin
63
78
  @cucumber_erb = if RUBY_VERSION >= '2.6'
64
79
  ERB.new(IO.read(cucumber_file), trim_mode: '%').result(binding)
@@ -68,19 +83,15 @@ Defined profiles in cucumber.yml:
68
83
  rescue StandardError
69
84
  raise(YmlLoadError, "cucumber.yml was found, but could not be parsed with ERB. Please refer to cucumber's documentation on correct profile usage.\n#{$ERROR_INFO.inspect}")
70
85
  end
86
+ end
71
87
 
88
+ def load_configuration
89
+ require 'yaml'
72
90
  begin
73
91
  @cucumber_yml = YAML.load(@cucumber_erb) # rubocop:disable Security/YAMLLoad
74
92
  rescue StandardError
75
93
  raise(YmlLoadError, "cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentation on correct profile usage.\n")
76
94
  end
77
-
78
- if @cucumber_yml.nil? || !@cucumber_yml.is_a?(Hash)
79
- raise(YmlLoadError, 'cucumber.yml was found, but was blank or malformed. ' \
80
- "Please refer to cucumber's documentation on correct profile usage.\n")
81
- end
82
-
83
- @cucumber_yml
84
95
  end
85
96
 
86
97
  # Locates cucumber.yml file. The file can end in .yml or .yaml,
@@ -54,7 +54,7 @@ module Cucumber
54
54
  end
55
55
 
56
56
  def seed
57
- Integer(@options[:seed] || rand(0xFFFF))
57
+ @options[:seed]
58
58
  end
59
59
 
60
60
  def dry_run?
@@ -168,9 +168,13 @@ module Cucumber
168
168
 
169
169
  def support_to_load
170
170
  support_files = all_files_to_load.select { |f| f =~ %r{/support/} }
171
+
172
+ # env_files are separated from other_files so we can ensure env files
173
+ # load first.
174
+ #
171
175
  env_files = support_files.select { |f| f =~ %r{/support/env\..*} }
172
176
  other_files = support_files - env_files
173
- @options[:dry_run] ? other_files : env_files + other_files
177
+ env_files.reverse + other_files.reverse
174
178
  end
175
179
 
176
180
  def all_files_to_load
@@ -10,8 +10,8 @@ module Cucumber
10
10
 
11
11
  begin
12
12
  raise new(with_prefix(step_name)) # rubocop:disable Style/RaiseArgs
13
- rescue StandardError => exception
14
- return exception
13
+ rescue StandardError => e
14
+ return e
15
15
  end
16
16
  end
17
17
 
@@ -12,7 +12,7 @@ module Cucumber
12
12
  end
13
13
 
14
14
  def on_gherkin_source_parsed(event)
15
- @gherkin_documents[event.gherkin_document[:uri]] = event.gherkin_document
15
+ @gherkin_documents[event.gherkin_document.uri] = event.gherkin_document
16
16
  end
17
17
 
18
18
  def gherkin_document(uri)
@@ -34,7 +34,7 @@ module Cucumber
34
34
  def snippet_step_keyword(test_step)
35
35
  uri = test_step.location.file
36
36
  document = gherkin_document(uri)
37
- dialect = ::Gherkin::Dialect.for(document[:feature][:language])
37
+ dialect = ::Gherkin::Dialect.for(document.feature.language)
38
38
  given_when_then_keywords = [dialect.given_keywords, dialect.when_keywords, dialect.then_keywords].flatten.uniq.reject { |kw| kw == '* ' }
39
39
  keyword_lookup = step_keyword_lookup(uri)
40
40
  keyword = nil
@@ -69,25 +69,28 @@ module Cucumber
69
69
 
70
70
  def initialize(gherkin_document)
71
71
  @lookup_hash = {}
72
- process_scenario_container(gherkin_document[:feature])
72
+ process_scenario_container(gherkin_document.feature)
73
73
  end
74
74
 
75
75
  private
76
76
 
77
77
  def process_scenario_container(container)
78
- container[:children].each do |child|
79
- if !child[:rule].nil?
80
- process_scenario_container(child[:rule])
81
- elsif !child[:scenario].nil?
82
- if child[:scenario][:examples].empty?
83
- @lookup_hash[child[:scenario][:location][:line]] = ScenarioSource.new(:Scenario, child[:scenario])
84
-
85
- else
86
- child[:scenario][:examples].each do |examples|
87
- examples[:table_body].each do |row|
88
- @lookup_hash[row[:location][:line]] = ScenarioOutlineSource.new(:ScenarioOutline, child[:scenario], examples, row)
89
- end
90
- end
78
+ container.children.each do |child|
79
+ if child.respond_to?(:rule) && child.rule
80
+ process_scenario_container(child.rule)
81
+ elsif child.respond_to?(:scenario) && child.scenario
82
+ process_scenario(child)
83
+ end
84
+ end
85
+ end
86
+
87
+ def process_scenario(child)
88
+ if child.scenario.examples.empty?
89
+ @lookup_hash[child.scenario.location.line] = ScenarioSource.new(:Scenario, child.scenario)
90
+ else
91
+ child.scenario.examples.each do |examples|
92
+ examples.table_body.each do |row|
93
+ @lookup_hash[row.location.line] = ScenarioOutlineSource.new(:ScenarioOutline, child.scenario, examples, row)
91
94
  end
92
95
  end
93
96
  end
@@ -99,22 +102,22 @@ module Cucumber
99
102
 
100
103
  def initialize(gherkin_document)
101
104
  @lookup_hash = {}
102
- process_scenario_container(gherkin_document[:feature])
105
+ process_scenario_container(gherkin_document.feature)
103
106
  end
104
107
 
105
108
  private
106
109
 
107
110
  def process_scenario_container(container)
108
- container[:children].each do |child|
109
- if !child[:rule].nil?
110
- process_scenario_container(child[:rule])
111
- elsif !child[:scenario].nil?
112
- child[:scenario][:steps].each do |step|
113
- @lookup_hash[step[:location][:line]] = StepSource.new(:Step, step)
111
+ container.children.each do |child|
112
+ if child.respond_to?(:rule) && child.rule
113
+ process_scenario_container(child.rule)
114
+ elsif child.respond_to?(:scenario) && child.scenario
115
+ child.scenario.steps.each do |step|
116
+ @lookup_hash[step.location.line] = StepSource.new(:Step, step)
114
117
  end
115
- elsif !child[:background].nil?
116
- child[:background][:steps].each do |step|
117
- @lookup_hash[step[:location][:line]] = StepSource.new(:Step, step)
118
+ elsif !child.background.nil?
119
+ child.background.steps.each do |step|
120
+ @lookup_hash[step.location.line] = StepSource.new(:Step, step)
118
121
  end
119
122
  end
120
123
  end
@@ -128,32 +131,34 @@ module Cucumber
128
131
 
129
132
  def initialize(gherkin_document)
130
133
  @lookup_hash = {}
131
- process_scenario_container(gherkin_document[:feature], nil)
134
+ process_scenario_container(gherkin_document.feature, nil)
132
135
  end
133
136
 
134
137
  private
135
138
 
139
+ # rubocop:disable Metrics/PerceivedComplexity
136
140
  def process_scenario_container(container, original_previous_node)
137
- container[:children].each do |child|
141
+ container.children.each do |child|
138
142
  previous_node = original_previous_node
139
- if !child[:rule].nil?
140
- process_scenario_container(child[:rule], original_previous_node)
141
- elsif !child[:scenario].nil?
142
- child[:scenario][:steps].each do |step|
143
- node = KeywordSearchNode.new(step[:keyword], previous_node)
144
- @lookup_hash[step[:location][:line]] = node
143
+ if child.respond_to?(:rule) && child.rule
144
+ process_scenario_container(child.rule, original_previous_node)
145
+ elsif child.respond_to?(:scenario) && child.scenario
146
+ child.scenario.steps.each do |step|
147
+ node = KeywordSearchNode.new(step.keyword, previous_node)
148
+ @lookup_hash[step.location.line] = node
145
149
  previous_node = node
146
150
  end
147
- elsif !child[:background].nil?
148
- child[:background][:steps].each do |step|
149
- node = KeywordSearchNode.new(step[:keyword], previous_node)
150
- @lookup_hash[step[:location][:line]] = node
151
+ elsif child.respond_to?(:background) && child.background
152
+ child.background.steps.each do |step|
153
+ node = KeywordSearchNode.new(step.keyword, previous_node)
154
+ @lookup_hash[step.location.line] = node
151
155
  previous_node = node
152
156
  original_previous_node = previous_node
153
157
  end
154
158
  end
155
159
  end
156
160
  end
161
+ # rubocop:enable Metrics/PerceivedComplexity
157
162
  end
158
163
  end
159
164
  end