gurke 3.3.3 → 3.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f0e20c2294765e444f6d57c93c0f396aacca045a6e68d38913841d9c10ac455
4
- data.tar.gz: f691ffa3fe1ee9675db5e030b30cab01d0e79444d4865eb42e101278115b7017
3
+ metadata.gz: 322a0da4f1144d8731c128defb26359658b933496b2f7033123e413cb754a74c
4
+ data.tar.gz: 6d14692f0061b371be67376920f3c5f76a8adc3dd8cc6a01b84dbe8d5796ea73
5
5
  SHA512:
6
- metadata.gz: e5acfcc8dc29a615b5d522ad375d13aa782663c8a1f5e5ccb7385e0416a617afab642911726a8ea4dbe6234a14b15d0dceecfc45e8a527e4537ac06b45570c7f
7
- data.tar.gz: 7b236cecf9842f9905b9160d65ee7641ecdb88004700de5766f88de1ac9c6b63e0e7cbecfef14153b80c8ef6a5add5c144cf47e6d4a41cfe6bdce0ca1e3a7401
6
+ metadata.gz: e9daef2468e65bd5df367479f6ab74ca0b492e9093f9984e4d7847fdb8e71d73fcea728e123593d09825967ee1ac41ef7b0abe03f2516d5f8edbd92938cf6749
7
+ data.tar.gz: 8c39e5a7be118c60a9c9a9996d7e2982b570640490d0d7e3e4f56bde0930507363343268360011cc3c85d563457f671c4734c8889c8b125f68c9e467056a3d43
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.3.5
4
+
5
+ * Test with Ruby 2.7, 3.0, 3.1, and 3.2
6
+ * Upgrade to Ruby 2.7+
7
+ * Fix required `StringIO` usage
8
+ * Fix `send :include`
9
+
10
+ ## 3.3.4
11
+
12
+ * Replace renamed trollop dependency with optimist
13
+
3
14
  ## 3.3.3
4
15
 
5
16
  * Fix a TC reporter issues reporting all scenarios as aborted
data/README.md CHANGED
@@ -1,16 +1,26 @@
1
1
  # Gurke
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/gurke.svg)](http://badge.fury.io/rb/gurke) [![Build Status](http://img.shields.io/travis/jgraichen/gurke/master.svg)](https://travis-ci.org/jgraichen/gurke) [![Code Climate](http://img.shields.io/codeclimate/github/jgraichen/gurke.svg)](https://codeclimate.com/github/jgraichen/gurke) [![Dependency Status](http://img.shields.io/gemnasium/jgraichen/gurke.svg)](https://gemnasium.com/jgraichen/gurke) [![RubyDoc Documentation](http://img.shields.io/badge/rubydoc-here-blue.svg)](http://rubydoc.info/github/jgraichen/gurke/master/frames)
3
+ [![Build Status](https://github.com/jgraichen/gurke/actions/workflows/test.yml/badge.svg)](https://github.com/jgraichen/gurke/actions/workflows/test.yml)
4
4
 
5
5
  **Gurke** is an experimental, alternative cucumber runner. It ~~steals~~ borrows ideas and concepts from [turnip](https://github.com/jnicklas/turnip), [rspec](http://rspec.info) and tries to avoid [cucumber](https://github.com/cucumber/cucumber/).
6
6
 
7
- That includes * Step definitions in modules * Before, After and Around hooks * Formatters * Partial step inclusion (via modules) * Keyword-dependent steps * Scenario-local world * Running DRb background test server.
7
+ That includes:
8
+
9
+ * Step definitions in modules
10
+ * Before, After and Around hooks
11
+ * Formatters
12
+ * Partial step inclusion (via modules)
13
+ * Keyword-dependent steps
14
+ * Scenario-local world
15
+ * Running DRb background test server.
8
16
 
9
17
  ## Installation
10
18
 
11
19
  Or install it yourself as:
12
20
 
13
- $ gem install gurke
21
+ ```console
22
+ gem install gurke
23
+ ```
14
24
 
15
25
  Or add it to your `Gemfile` and install it using bundler.
16
26
 
@@ -18,11 +28,11 @@ Or add it to your `Gemfile` and install it using bundler.
18
28
 
19
29
  ## Usage
20
30
 
21
- 1. Put features in `features/`.
31
+ First, create your `*.features` files inside `features/`, for example, `features/user/create_account.feature`. Support files and step definitions can be added as Ruby files to `features/support`.
22
32
 
23
- 2. Put support and configuration files as ruby into `features/support/**`.
33
+ ### Configuration
24
34
 
25
- e.g.
35
+ For example, you can configure the environment or [hooks](#hooks):
26
36
 
27
37
  ```ruby
28
38
  # features/support/gurke.rb
@@ -39,7 +49,9 @@ Gurke.configure do |c|
39
49
  end
40
50
  ```
41
51
 
42
- 3. Put your step definitions into `features/support/**`.
52
+ ### Steps
53
+
54
+ Steps can be defined in Ruby modules as methods, for example in `features/support/steps`:
43
55
 
44
56
  ```ruby
45
57
  # features/support/steps/file_steps.rb
@@ -55,7 +67,7 @@ end
55
67
  Gurke.configure{|c| c.include FileSteps }
56
68
  ```
57
69
 
58
- You can also use an existing method as a step:
70
+ You can use an existing method as a step too:
59
71
 
60
72
  ```ruby
61
73
  module MySteps
@@ -88,9 +100,9 @@ Gurke.configure do |c|
88
100
  end
89
101
  ```
90
102
 
91
- Therefore you can use different step implementations for same named steps depending on the tags of the the feature and scenario.
103
+ Therefore, you can use different step implementations for same named steps depending on the tags of the feature and scenario.
92
104
 
93
- ### Keyword specific step definitions
105
+ #### Keyword specific step definitions
94
106
 
95
107
  You can also define steps for only a specific keyword. This also allows you to use the same step pattern for different keywords, e.g.
96
108
 
@@ -101,23 +113,23 @@ module PathSteps
101
113
  end
102
114
  ```
103
115
 
104
- Therefore you can write your scenarios in a documentary style of facts:
116
+ Therefore, you can write your scenarios in a documentary style of facts:
105
117
 
106
- ```
107
- Scenario: Use the back button
108
- Given I am on the start page
109
- When I click on "Go to another page"
110
- And I click the back button
111
- Then I am on the start page
118
+ ```feature
119
+ Scenario: Use the back button
120
+ Given I am on the start page
121
+ When I click on "Go to another page"
122
+ And I click the back button
123
+ Then I am on the start page
112
124
  ```
113
125
 
114
126
  `And` and `But` steps will inherit the keyword type from the step before, e.g. the `And` step above will be of the `when` type.
115
127
 
116
- ### Included Step Definitions & Hooks
128
+ ### Hooks
117
129
 
118
- Each scenario runs in it's own world. All modules registered to be included will be included in this world. Before and after scenario or step hooks will also be executed within this world. All steps are run in this world.
130
+ Each scenario runs in its own world. All modules registered to be included will be included in this world. Before and after scenario or step hooks will also be executed within this world. All steps are run in this world.
119
131
 
120
- You can define hooks similar to RSpec:
132
+ You can define hooks similar to `rspec`:
121
133
 
122
134
  ```ruby
123
135
  Gurke.configure do |config|
@@ -152,13 +164,13 @@ Examples:
152
164
 
153
165
  You can also specify a list of files that will be run:
154
166
 
155
- ```
167
+ ```console
156
168
  gurke features/my_feature.feature
157
169
  ```
158
170
 
159
171
  If you append one or more line numbers - separated by colons - only the scenarios defined around the given lines will be run:
160
172
 
161
- ```
173
+ ```console
162
174
  gurke features/my_feature.feature:14:34
163
175
  ```
164
176
 
@@ -166,7 +178,7 @@ gurke features/my_feature.feature:14:34
166
178
 
167
179
  If you have scenarios that might fail sometime, you can mark them as `@flaky`:
168
180
 
169
- ```
181
+ ```feature
170
182
  Feature: F
171
183
  @flaky
172
184
  Scenario: I am flaky
@@ -180,7 +192,7 @@ Gurke will retry a marked scenario only once if a step failed.
180
192
 
181
193
  You can choose another formatter using a command line switch:
182
194
 
183
- ```
195
+ ```console
184
196
  gurke -f team_city
185
197
  ```
186
198
 
@@ -200,9 +212,9 @@ Remember to reload e.g. your step definitions before `:features` to pick up chan
200
212
  end
201
213
  ```
202
214
 
203
- Use the after `:system` hook to shutdown resources.
215
+ Use the after `:system` hook to shut down resources.
204
216
 
205
- Remember to restart background server when changing hooks, configuration or removing/redefining steps as otherwise the changes won't be picked up or steps won't change or are ambiguous now.
217
+ Remember to restart the running background server when changing hooks, configuration or removing/redefining steps as otherwise the changes won't be picked up, steps won't change, or are ambiguous now.
206
218
 
207
219
  ## TODO
208
220
 
@@ -211,16 +223,8 @@ Remember to restart background server when changing hooks, configuration or remo
211
223
  * Random run order (rspec)
212
224
  * Using strings with placeholders as step pattern (turnip)
213
225
  * Custom placeholders (turnip)
214
- * More reporters (NyanCat / JUnit / TeamCity / Adapter to run multiple reporters)
226
+ * More reporters (NyanCat / JUnit / Adapter to run multiple reporters)
215
227
  * SimpleCov support (and use it in own tests)
216
228
  * Scope hooks by scenario tags
217
229
  * Fast-fail
218
230
  * Additional feature-scope and global worlds
219
-
220
- ## History
221
-
222
- Now: * Can finally (start to) test itself.
223
-
224
- ## Contributing
225
-
226
- Send me code.
@@ -5,21 +5,17 @@ require 'open3'
5
5
  module CLISteps
6
6
  def _execute(args = nil)
7
7
  Dir.chdir(@__root) do
8
- Bundler.with_clean_env do
9
- cmd = ['ruby']
10
- cmd << '-I' << Gurke.root.join('..', 'lib').realpath
11
- cmd << '-S' << Gurke.root.join('..', 'bin', 'gurke').realpath
8
+ cmd = %w[bundle exec gurke]
12
9
 
13
- unless args.to_s.include?('-f ') || args.to_s.include?('--formatter ')
14
- cmd << '-f' << 'default'
15
- end
10
+ unless args.to_s.include?('-f ') || args.to_s.include?('--formatter ')
11
+ cmd << '-f' << 'default'
12
+ end
16
13
 
17
- cmd << args.to_s
14
+ cmd << args.to_s
18
15
 
19
- out, err, status = Open3.capture3 cmd.join ' '
16
+ out, err, status = Open3.capture3 cmd.join ' '
20
17
 
21
- @last_process = [Integer(status), out, err]
22
- end
18
+ @last_process = [Integer(status), out, err]
23
19
  end
24
20
  end
25
21
 
@@ -46,7 +42,7 @@ module CLISteps
46
42
  end
47
43
 
48
44
  step(/the program output should not include "(.*?)"/,
49
- :_cli_not_include_content)
45
+ :_cli_not_include_content,)
50
46
 
51
47
  step(/all scenarios have passed/) do
52
48
  _cli_include_content 'scenarios: 0 failing, 0 pending'
data/gurke.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'gurke/version'
6
6
 
@@ -8,32 +8,25 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'gurke'
9
9
  spec.version = Gurke::VERSION
10
10
  spec.authors = ['Jan Graichen']
11
- spec.email = %w[jg@altimos.de]
11
+ spec.email = %w[jgraichen@altimos.de]
12
12
  spec.homepage = 'https://github.com/jgraichen/gurke'
13
13
  spec.license = 'MIT'
14
14
 
15
- spec.description = \
16
- 'An alternative gherkin feature runner inspired by rspec and turnip.'
17
15
  spec.summary = \
18
16
  'An alternative gherkin feature runner inspired by rspec and turnip.'
19
17
 
18
+ spec.metadata['rubygems_mfa_required'] = 'true'
19
+ spec.required_ruby_version = '>= 2.7.0'
20
+
20
21
  spec.files = Dir['**/*'].grep %r{^(
21
22
  (bin/|lib/|test/|spec/|features/)|
22
23
  (\w*\.gemspec|LICENSE.*|README.*|CHANGELOG.*)$
23
24
  )}x
24
25
 
25
26
  spec.executables = spec.files.grep(%r{^bin/}) {|f| File.basename(f) }
26
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
27
27
  spec.require_paths = %w[lib]
28
28
 
29
29
  spec.add_dependency 'colorize'
30
30
  spec.add_dependency 'gherkin', '~> 2.0'
31
- spec.add_dependency 'trollop'
32
-
33
- spec.add_development_dependency 'bundler', '~> 1.3'
34
-
35
- if ENV['TRAVIS_BUILD_NUMBER'] && !ENV['TRAVIS_TAG']
36
- # Append travis build number for auto-releases
37
- spec.version = "#{spec.version}.1.b#{ENV['TRAVIS_BUILD_NUMBER']}"
38
- end
31
+ spec.add_dependency 'optimist', '~> 3.0'
39
32
  end
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gurke
4
- #
5
4
  class Background
6
5
  #
7
6
  # Return path to file containing this background.
data/lib/gurke/builder.rb CHANGED
@@ -10,7 +10,7 @@ module Gurke
10
10
  def initialize
11
11
  @language = 'en'
12
12
  @parser = Gherkin::Parser::Parser.new(
13
- self, true, 'root', false, @language
13
+ self, true, 'root', false, @language,
14
14
  )
15
15
  end
16
16
 
data/lib/gurke/cli.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'trollop'
3
+ require 'optimist'
4
4
 
5
5
  module Gurke
6
6
  class CLI
@@ -11,11 +11,11 @@ module Gurke
11
11
  #
12
12
  def run(argv)
13
13
  call parser.parse(argv), argv
14
- rescue Trollop::VersionNeeded
14
+ rescue Optimist::VersionNeeded
15
15
  print_version && exit
16
- rescue Trollop::HelpNeeded
16
+ rescue Optimist::HelpNeeded
17
17
  print_help && exit
18
- rescue Trollop::CommandlineError => e
18
+ rescue Optimist::CommandlineError => e
19
19
  warn "Error: #{e}"
20
20
  warn "Run with `-h' for more information on available arguments."
21
21
  exit 255
@@ -56,7 +56,7 @@ module Gurke
56
56
  end
57
57
 
58
58
  def parser
59
- @parser ||= Trollop::Parser.new do
59
+ @parser ||= Optimist::Parser.new do
60
60
  opt :help, 'Print this help.'
61
61
  opt :version, 'Show program version information.'
62
62
  opt :backtrace, 'Show full error backtraces.'
@@ -67,7 +67,7 @@ module Gurke
67
67
  opt :require, 'Files matching this pattern will be required after' \
68
68
  'loading environment but before running features.',
69
69
  default: ['features/steps/**/*.rb',
70
- 'features/support/steps/**/*.rb'],
70
+ 'features/support/steps/**/*.rb',],
71
71
  multi: true
72
72
  opt :tags, 'Only run features and scenarios matching given tag ' \
73
73
  'filtering expression. TODO: Description.',
@@ -85,7 +85,7 @@ module Gurke
85
85
  files = Dir[options[:pattern].to_s] if files.empty? && options[:pattern]
86
86
  files.each_with_object([]) do |input, memo|
87
87
  if File.directory? input
88
- Dir[input + '/**/*'].each do |file_in_dir|
88
+ Dir["#{input}/**/*"].each do |file_in_dir|
89
89
  if options[:pattern] &&
90
90
  !File.fnmatch?(options[:pattern], file_in_dir)
91
91
  next
@@ -91,7 +91,7 @@ module Gurke
91
91
  feature: HookSet.new,
92
92
  scenario: HookSet.new,
93
93
  step: HookSet.new,
94
- system: HookSet.new
94
+ system: HookSet.new,
95
95
  }
96
96
 
97
97
  hooks[:each] = hooks[:scenario]
@@ -152,11 +152,9 @@ module Gurke
152
152
  end.call
153
153
  ensure
154
154
  @after.each do |hook|
155
- begin
156
- hook.run world, ctx
157
- rescue StandardError => e
158
- warn "Rescued error in after hook: #{e}\n#{e.backtrace.join("\n")}"
159
- end
155
+ hook.run world, ctx
156
+ rescue StandardError => e
157
+ warn "Rescued error in after hook: #{e}\n#{e.backtrace.join("\n")}"
160
158
  end
161
159
  end
162
160
 
data/lib/gurke/dsl.rb CHANGED
@@ -8,7 +8,7 @@ module Gurke
8
8
  method_name = nil
9
9
  end
10
10
 
11
- if method_name && block_given?
11
+ if method_name && block
12
12
  raise ArgumentError.new <<~ERR.strip
13
13
  You can either specify a method name or given a block, not both.
14
14
  ERR
@@ -24,14 +24,14 @@ module Gurke
24
24
  step.match(name, s)
25
25
  end
26
26
 
27
- if block_given?
27
+ if block
28
28
  define_method(step.method_name.to_s, &block)
29
29
  elsif method_name
30
30
  alias_method step.method_name.to_s, method_name
31
31
  end
32
32
  end
33
33
 
34
- # rubocop:disable MethodName
34
+ # rubocop:disable Naming/MethodName
35
35
  def Given(pattern, method_name = nil, opts = {}, &block)
36
36
  step pattern, method_name, opts.merge(type: :given), &block
37
37
  end
@@ -43,6 +43,6 @@ module Gurke
43
43
  def Then(pattern, method_name = nil, opts = {}, &block)
44
44
  step pattern, method_name, opts.merge(type: :then), &block
45
45
  end
46
- # rubocop:enable MethodName
46
+ # rubocop:enable Naming/MethodName
47
47
  end
48
48
  end
@@ -30,7 +30,7 @@ module Gurke
30
30
  filter = Filter.new options, files
31
31
 
32
32
  each do |feature|
33
- file, _lines = files.select {|f, _| f == feature.file }.first
33
+ file, _lines = files.find {|f, _| f == feature.file }
34
34
  next unless file
35
35
 
36
36
  f = Feature.new(feature)
@@ -53,7 +53,7 @@ module Gurke
53
53
  each do |feature|
54
54
  feature.run runner, reporter
55
55
  end
56
- rescue Interrupt # rubocop:disable HandleExceptions
56
+ rescue Interrupt
57
57
  # nothing
58
58
  ensure
59
59
  reporter.invoke :end_features, self
@@ -84,7 +84,7 @@ module Gurke
84
84
  end
85
85
 
86
86
  def filtered_by_line?(scenario)
87
- _, lines = files.select {|f, _| f == scenario.file }.first
87
+ _, lines = files.find {|f, _| f == scenario.file }
88
88
 
89
89
  return false if lines.empty?
90
90
 
@@ -93,7 +93,7 @@ module Gurke
93
93
 
94
94
  TagFilter = Struct.new(:tag) do
95
95
  def name
96
- @name ||= negated? ? tag[1..-1] : tag
96
+ @name ||= negated? ? tag[1..] : tag
97
97
  end
98
98
 
99
99
  def negated?
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'stringio'
4
+
3
5
  module Gurke
4
6
  #
5
7
  # A {Reporter} provides callbacks that will be executed whenever
@@ -275,26 +277,26 @@ module Gurke
275
277
 
276
278
  protected
277
279
 
278
- def format_exception(ex, backtrace: true, indent: 0)
279
- s = StringIO.new
280
- s << (' ' * indent) << ex.class.to_s << ': ' << ex.message.strip << "\n"
280
+ def format_exception(err, backtrace: true, indent: 0)
281
+ s = ::StringIO.new
282
+ s << (' ' * indent) << err.class.to_s << ': ' << err.message.strip << "\n"
281
283
 
282
- if backtrace && ex.respond_to?(:backtrace)
283
- if ex.backtrace.nil?
284
+ if backtrace && err.respond_to?(:backtrace)
285
+ if err.backtrace.nil?
284
286
  s << (' ' * indent) << ' <no backtrace available>'
285
- elsif ex.backtrace.empty?
287
+ elsif err.backtrace.empty?
286
288
  s << (' ' * indent) << ' <backtrace empty>'
287
289
  else
288
- ex.backtrace.each do |bt|
290
+ err.backtrace.each do |bt|
289
291
  s << (' ' * indent) << ' ' << bt.strip << "\n"
290
292
  end
291
293
  end
292
294
  end
293
295
 
294
- if ex.respond_to?(:cause) && ex.cause && ex.cause.respond_to?(:message)
296
+ if err.respond_to?(:cause) && err.cause && err.cause.respond_to?(:message)
295
297
  s << (' ' * indent) << 'caused by: '
296
298
  s << format_exception(
297
- ex.cause, backtrace: backtrace, indent: indent
299
+ err.cause, backtrace: backtrace, indent: indent,
298
300
  ).strip
299
301
  end
300
302
 
@@ -9,11 +9,11 @@ require 'colorize'
9
9
  # :light_magenta, :light_cyan, :light_white
10
10
  #
11
11
  module Gurke::Reporters
12
- #
13
12
  class CompactReporter < NullReporter
14
13
  attr_reader :io
15
14
 
16
15
  def initialize(io = $stdout)
16
+ super()
17
17
  @io = io
18
18
  end
19
19
 
@@ -95,10 +95,10 @@ module Gurke::Reporters
95
95
  scenarios = features.map(&:scenarios).flatten
96
96
 
97
97
  size = scenarios.size
98
- passed = scenarios.select(&:passed?).size
99
- failed = scenarios.select(&:failed?).size
100
- pending = scenarios.select(&:pending?).size
101
- not_run = size - scenarios.select(&:run?).size
98
+ passed = scenarios.count(&:passed?)
99
+ failed = scenarios.count(&:failed?)
100
+ pending = scenarios.count(&:pending?)
101
+ not_run = size - scenarios.count(&:run?)
102
102
 
103
103
  message = "#{scenarios.size} scenarios: "
104
104
  message += "#{passed} passed, "
@@ -130,7 +130,6 @@ module Gurke::Reporters
130
130
  magenta cyan white default light_black
131
131
  light_red light_green light_yellow light_blue
132
132
  light_magenta light_cyan light_white].each do |color|
133
-
134
133
  define_method(color) {|str| io.tty? ? str.send(color) : str }
135
134
  end
136
135
  end
@@ -17,6 +17,7 @@ module Gurke::Reporters
17
17
  attr_reader :io
18
18
 
19
19
  def initialize(io = $stdout)
20
+ super()
20
21
  @io = io
21
22
  end
22
23
 
@@ -93,10 +94,10 @@ module Gurke::Reporters
93
94
  scenarios = features.map(&:scenarios).flatten
94
95
 
95
96
  size = scenarios.size
96
- passed = scenarios.select(&:passed?).size
97
- failed = scenarios.select(&:failed?).size
98
- pending = scenarios.select(&:pending?).size
99
- not_run = size - scenarios.select(&:run?).size
97
+ passed = scenarios.count(&:passed?)
98
+ failed = scenarios.count(&:failed?)
99
+ pending = scenarios.count(&:pending?)
100
+ not_run = size - scenarios.count(&:run?)
100
101
 
101
102
  message = "#{scenarios.size} scenarios: "
102
103
  message += "#{passed} passed, " unless passed == size || passed.zero?
@@ -159,7 +160,6 @@ module Gurke::Reporters
159
160
  magenta cyan white default light_black
160
161
  light_red light_green light_yellow light_blue
161
162
  light_magenta light_cyan light_white].each do |color|
162
-
163
163
  define_method(color) {|str| io.tty? ? str.send(color) : str }
164
164
  end
165
165
  end
@@ -6,7 +6,7 @@ module Gurke::Reporters
6
6
  #
7
7
  class NullReporter < Gurke::Reporter
8
8
  Gurke::Reporter::CALLBACKS.each do |cb|
9
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
9
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1 # rubocop:disable Style/DocumentDynamicEvalDefinition
10
10
  def #{cb}(*) end
11
11
  RUBY
12
12
  end
@@ -49,7 +49,7 @@ module Gurke::Reporters
49
49
 
50
50
  def publish(message_name, args)
51
51
  args = [] << message_name.to_s << escaped_array_of(args)
52
- args = args.flatten.reject(&:nil?)
52
+ args = args.flatten.compact
53
53
 
54
54
  io.puts "##teamcity[#{args.join(' ')}]"
55
55
  end
data/lib/gurke/runner.rb CHANGED
@@ -11,10 +11,10 @@ module Gurke
11
11
 
12
12
  def reporter
13
13
  @reporter ||= begin
14
- r = (options[:formatter] + '_reporter')
15
- .split('_')
16
- .map(&:capitalize)
17
- .join
14
+ r = "#{options[:formatter]}_reporter"
15
+ .split('_')
16
+ .map(&:capitalize)
17
+ .join
18
18
 
19
19
  Reporters.const_get(r).new
20
20
  end
@@ -27,7 +27,7 @@ module Gurke
27
27
  def run(files, reporter = self.reporter)
28
28
  files.map! do |file|
29
29
  split = file.split(':')
30
- [split[0], split[1..-1].map {|i| Integer(i) }]
30
+ [split[0], split[1..].map {|i| Integer(i) }]
31
31
  end
32
32
 
33
33
  features = builder.load(files.map {|file, _| file })
@@ -29,7 +29,6 @@ module Gurke
29
29
  #
30
30
  attr_reader :steps
31
31
 
32
- #
33
32
  attr_reader :tags
34
33
 
35
34
  # @api private
data/lib/gurke/step.rb CHANGED
@@ -66,7 +66,7 @@ module Gurke
66
66
  rescue StepPending => e
67
67
  scenario.pending! e
68
68
  result = StepResult.new self, scenario, :pending, e
69
- rescue Exception => e # rubocop:disable RescueException
69
+ rescue Exception => e # rubocop:disable Lint/RescueException
70
70
  scenario.failed! e
71
71
  result = StepResult.new self, scenario, :failed, e
72
72
  ensure
@@ -88,7 +88,6 @@ module Gurke
88
88
  end
89
89
  end
90
90
 
91
- #
92
91
  class StepResult
93
92
  attr_reader :step, :exception, :state, :scenario
94
93
 
@@ -100,7 +99,7 @@ module Gurke
100
99
  end
101
100
 
102
101
  Step.public_instance_methods(false).each do |mth|
103
- class_eval <<-RUBY, __FILE__, __LINE__ + 1
102
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1 # rubocop:disable Style/DocumentDynamicEvalDefinition
104
103
  def #{mth}(*args) @step.send(:#{mth}, *args); end
105
104
  RUBY
106
105
  end
@@ -20,11 +20,12 @@ module Gurke
20
20
  def match(name, type = :any)
21
21
  return if self.type != :any && self.type != type
22
22
  return if pattern.is_a?(String) && name != pattern
23
+
23
24
  match = pattern.match(name)
24
25
 
25
26
  return unless match
26
27
 
27
- Match.new method_name, match.to_a[1..-1]
28
+ Match.new method_name, match.to_a[1..]
28
29
  end
29
30
 
30
31
  Match = Struct.new :method_name, :params