gurke 3.4.0 → 3.5.1

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
2
  SHA256:
3
- metadata.gz: b6701a22fdedaffd847fa2cb45077bed6d3bbbf7f6c1faf996a9908bac7ca335
4
- data.tar.gz: 621bf975bcaf87268a5f98e28b7a15830820d4eef866fcccc74766c15ceecbf8
3
+ metadata.gz: 710b7c0f7f8ea2be601b05c87d0ab4d8bd82a2a4b823097ec5eee6623dfe716c
4
+ data.tar.gz: a895ccddac2e6124aa876964478d0a47f4b2b0784c343a6d977a6a2996b104c9
5
5
  SHA512:
6
- metadata.gz: 3933d5b317b1da87502c1c171b39e48975184720ae9924196c6e05ddfbf922b26ec75c5ce39df087d4a9e51e5f331ec60c435a3bc81bcb31d0166e2ebe8369d4
7
- data.tar.gz: 4e2d338ef6266709da78fd237906e20cd49839d4e0e55e4005251815b4802924d35436841e15a5b48ea13793dedf1876ce9b9ef157b62c934a0fdb00cb2fe5c5
6
+ metadata.gz: 5066a5b8feea6cb4be92c8fd3f61ef4a56394dad2f25c51a48015786e1dea66ffddabce74558a85228e1f8463467d72bdc143e659fdc94c9bf40fc537ceeb877
7
+ data.tar.gz: 12186efacb0655f0afa172a74b214c66b6833743c79604fa3c63f34672116be69cf52eccdd0b165575133d24f0a8d5bf86acfe0b5e238cac2c738f310c8adaa4
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.5.1] - 2025-04-10
11
+
12
+ ### Changed
13
+
14
+ - Print spaces on empty lines to improve logging GitLab CI/CD
15
+
16
+ ## [3.5.0] - 2025-04-09
17
+
18
+ ### Added
19
+
20
+ - Add `--color=[(auto)|on|off]` command line flag
21
+
10
22
  ## [3.4.0] - 2024-08-28
11
23
 
12
24
  ### Added
@@ -130,7 +142,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
130
142
 
131
143
  ## [1.0.0] - 2013-12-04
132
144
 
133
- [Unreleased]: https://github.com/jgraichen/gurke/compare/v3.4.0...HEAD
145
+ [Unreleased]: https://github.com/jgraichen/gurke/compare/v3.5.1...HEAD
146
+ [3.5.1]: https://github.com/jgraichen/gurke/compare/v3.5.0...v3.5.1
147
+ [3.5.0]: https://github.com/jgraichen/gurke/compare/v3.4.0...v3.5.0
134
148
  [3.4.0]: https://github.com/jgraichen/gurke/compare/v3.3.5...v3.4.0
135
149
  [3.3.5]: https://github.com/jgraichen/gurke/compare/v3.3.4...v3.3.5
136
150
  [3.3.4]: https://github.com/jgraichen/gurke/compare/v3.3.3...v3.3.4
data/gurke.gemspec CHANGED
@@ -28,5 +28,4 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.add_dependency 'colorize'
30
30
  spec.add_dependency 'gherkin', '~> 2.0'
31
- spec.add_dependency 'optimist', '~> 3.0'
32
31
  end
data/lib/gurke/cli.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'optimist'
3
+ require 'optparse'
4
4
 
5
5
  module Gurke
6
6
  class CLI
@@ -10,13 +10,101 @@ module Gurke
10
10
  # @param argv [Array<String>] Tokenized argument list.
11
11
  #
12
12
  def run(argv)
13
- call parser.parse(argv), argv
14
- rescue Optimist::VersionNeeded
15
- print_version && exit
16
- rescue Optimist::HelpNeeded
17
- print_help && exit
18
- rescue Optimist::CommandlineError => e
19
- warn "Error: #{e}"
13
+ options = {
14
+ backtrace: false,
15
+ drb_server: false,
16
+ drb: false,
17
+ force_color: false,
18
+ formatter: 'default',
19
+ pattern: 'features/**/*.feature',
20
+ require: [],
21
+ tags: [],
22
+ }
23
+
24
+ OptionParser.new do |opts| # rubocop:disable Metrics/BlockLength
25
+ opts.banner = 'Usage: gurke [options] [files...]'
26
+
27
+ opts.on('-h', '--help', 'Print this help.') do
28
+ puts opts
29
+ exit
30
+ end
31
+
32
+ opts.on('-v', '--version', 'Show program version information.') do
33
+ puts "gurke v#{Gurke::VERSION}"
34
+ exit
35
+ end
36
+
37
+ opts.on('-b', '--backtrace', 'Show full error backtraces.') do
38
+ options[:backtrace] = true
39
+ end
40
+
41
+ opts.on(
42
+ '-f', '--formatter=<s>',
43
+ 'Select a special formatter as reporter (default: "default")',
44
+ ) do |arg|
45
+ options[:formatter] = arg.to_s
46
+ end
47
+
48
+ opts.on(
49
+ '-r', '--require=<s>',
50
+ 'Files matching this pattern will be required after loading ' \
51
+ 'environment but before running features. ' \
52
+ '(Default: features/steps/**/*.rb, features/support/steps/**/*.rb)',
53
+ ) do |arg|
54
+ options[:require] << arg.to_s
55
+ end
56
+
57
+ opts.on(
58
+ '-t', '--tags=<s>',
59
+ 'Only run features and scenarios matching given tag ' \
60
+ 'filtering expression. (Default: ~wip)',
61
+ ) do |arg|
62
+ options[:tags] << arg.to_s
63
+ end
64
+
65
+ opts.on(
66
+ '-p', '--pattern=<s>',
67
+ 'File pattern matching feature files to be run. (Default: features/**/*.feature)',
68
+ ) do |arg|
69
+ options[:pattern] = arg.to_s
70
+ end
71
+
72
+ opts.on('--drb', 'Run features on already started DRb server. (experimental)') do
73
+ options[:drb] = true
74
+ end
75
+
76
+ opts.on('--drb-server', 'Run features on already started DRb server. (experimental)') do
77
+ options[:drb_server] = true
78
+ end
79
+
80
+ opts.on('-c', '--color=<mode>', 'Colored output (default: "auto")') do |arg|
81
+ value = arg.to_s.downcase
82
+ if value == 'auto'
83
+ options[:color] = :auto
84
+ elsif %w[1 yes on true t force].include?(value)
85
+ options[:color] = true
86
+ elsif %w[0 no off false f].include?(value)
87
+ options[:color] = false
88
+ else
89
+ warn "Invalid value for color: #{value}"
90
+ warn 'Supported values are: 0, 1, yes, no, true, false, t, f, force, auto'
91
+ exit 255
92
+ end
93
+ end
94
+ end.parse!(argv)
95
+
96
+ if options[:require].empty?
97
+ options[:require] << 'features/steps/**/*.rb'
98
+ options[:require] << 'features/support/steps/**/*.rb'
99
+ end
100
+
101
+ if options[:tags].empty?
102
+ options[:tags] << '~wip'
103
+ end
104
+
105
+ call(options, argv)
106
+ rescue OptionParser::InvalidOption => e
107
+ warn e.message
20
108
  warn "Run with `-h' for more information on available arguments."
21
109
  exit 255
22
110
  end
@@ -45,40 +133,6 @@ module Gurke
45
133
  Kernel.exit runner.run files
46
134
  end
47
135
 
48
- def print_version
49
- $stdout.puts <<~VSTR
50
- gurke v#{Gurke::VERSION}
51
- VSTR
52
- end
53
-
54
- def print_help
55
- parser.educate($stdout)
56
- end
57
-
58
- def parser
59
- @parser ||= Optimist::Parser.new do
60
- opt :help, 'Print this help.'
61
- opt :version, 'Show program version information.'
62
- opt :backtrace, 'Show full error backtraces.'
63
- opt :formatter, 'Select a special formatter as reporter', \
64
- default: 'default'
65
- opt :pattern, 'File pattern matching feature files to be run.',
66
- default: 'features/**/*.feature'
67
- opt :require, 'Files matching this pattern will be required after' \
68
- 'loading environment but before running features.',
69
- default: ['features/steps/**/*.rb',
70
- 'features/support/steps/**/*.rb',],
71
- multi: true
72
- opt :tags, 'Only run features and scenarios matching given tag ' \
73
- 'filtering expression. TODO: Description.',
74
- default: ['~wip'],
75
- multi: true
76
- opt :drb_server, 'Run gurke DRb server. (experimental)', short: :none
77
- opt :drb, 'Run features on already started DRb server. (experimental)',
78
- short: :none
79
- end
80
- end
81
-
82
136
  private
83
137
 
84
138
  def expand_files(files, options)
@@ -36,6 +36,8 @@ module Gurke
36
36
  retry_scenario
37
37
  ].freeze
38
38
 
39
+ def initialize(**kwargs); end
40
+
39
41
  # Called before the execution of any feature and before any
40
42
  # before-features hook is invoked.
41
43
  #
@@ -293,7 +295,7 @@ module Gurke
293
295
  end
294
296
  end
295
297
 
296
- if err.respond_to?(:cause) && err.cause && err.cause.respond_to?(:message)
298
+ if err.respond_to?(:cause) && err.cause.respond_to?(:message)
297
299
  s << (' ' * indent) << 'caused by: '
298
300
  s << format_exception(
299
301
  err.cause, backtrace: backtrace, indent: indent,
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'colorize'
4
+
5
+ # Colors
6
+ # :black, :red, :green, :yellow, :blue,
7
+ # :magenta, :cyan, :white, :default, :light_black,
8
+ # :light_red, :light_green, :light_yellow, :light_blue,
9
+ # :light_magenta, :light_cyan, :light_white
10
+ #
11
+ module Gurke::Reporters
12
+ module Colored
13
+ def initialize(color: nil, **kwargs)
14
+ super(**kwargs)
15
+
16
+ case color
17
+ when :auto, nil
18
+ @colored = io.tty?
19
+ when TrueClass
20
+ @colored = true
21
+ when FalseClass
22
+ @colored = false
23
+ end
24
+ end
25
+
26
+ def color?
27
+ (@color == :auto && io.tty?) || @color
28
+ end
29
+
30
+ protected
31
+
32
+ %i[black red green yellow blue
33
+ magenta cyan white default light_black
34
+ light_red light_green light_yellow light_blue
35
+ light_magenta light_cyan light_white].each do |color|
36
+ define_method(color) do |str|
37
+ @colored ? str.send(color) : str
38
+ end
39
+ end
40
+ end
41
+ end
@@ -1,30 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'colorize'
4
-
5
- # Colors
6
- # :black, :red, :green, :yellow, :blue,
7
- # :magenta, :cyan, :white, :default, :light_black,
8
- # :light_red, :light_green, :light_yellow, :light_blue,
9
- # :light_magenta, :light_cyan, :light_white
10
- #
11
3
  module Gurke::Reporters
12
4
  class CompactReporter < NullReporter
5
+ include Colored
6
+
13
7
  attr_reader :io
14
8
 
15
- def initialize(io = $stdout)
16
- super()
9
+ def initialize(io: $stdout, **kwargs)
17
10
  @io = io
11
+ super(**kwargs)
18
12
  end
19
13
 
20
14
  def after_step(result, scenario, *)
21
15
  return unless result.state == :failed
22
16
 
23
17
  io.print red 'E'
18
+ io.puts
24
19
 
25
20
  feature = scenario.feature
26
21
 
27
- io.puts
28
22
  io.print yellow('Feature')
29
23
  io.print ': '
30
24
  io.print scenario.feature.name
@@ -73,7 +67,7 @@ module Gurke::Reporters
73
67
 
74
68
  exout = format_exception(result.exception, backtrace: true, indent: 6)
75
69
  io.puts red exout
76
- io.puts
70
+ io.puts ' '
77
71
  end
78
72
 
79
73
  def after_scenario(scenario)
@@ -84,13 +78,13 @@ module Gurke::Reporters
84
78
  elsif scenario.passed?
85
79
  io.print green '.'
86
80
  elsif scenario.aborted?
87
- io.puts
81
+ io.puts ' '
88
82
  end
89
83
  end
90
84
 
91
85
  def after_features(features)
92
- io.puts
93
- io.puts
86
+ io.puts ' '
87
+ io.puts ' '
94
88
 
95
89
  scenarios = features.map(&:scenarios).flatten
96
90
 
@@ -125,12 +119,5 @@ module Gurke::Reporters
125
119
 
126
120
  light_black("# #{path}:#{line}")
127
121
  end
128
-
129
- %i[black red green yellow blue
130
- magenta cyan white default light_black
131
- light_red light_green light_yellow light_blue
132
- light_magenta light_cyan light_white].each do |color|
133
- define_method(color) {|str| io.tty? ? str.send(color) : str }
134
- end
135
122
  end
136
123
  end
@@ -1,11 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Colors
4
- # :black, :red, :green, :yellow, :blue,
5
- # :magenta, :cyan, :white, :default, :light_black,
6
- # :light_red, :light_green, :light_yellow, :light_blue,
7
- # :light_magenta, :light_cyan, :light_white
8
- #
9
3
  module Gurke::Reporters
10
4
  #
11
5
  # The {DefaultReporter} prints features, scenarios and
@@ -14,11 +8,13 @@ module Gurke::Reporters
14
8
  # That includes colorized step results reports etc.
15
9
  #
16
10
  class DefaultReporter < NullReporter
11
+ include Colored
12
+
17
13
  attr_reader :io
18
14
 
19
- def initialize(io = $stdout)
20
- super()
15
+ def initialize(io: $stdout, **kwargs)
21
16
  @io = io
17
+ super(**kwargs)
22
18
  end
23
19
 
24
20
  def before_feature(feature)
@@ -31,7 +27,7 @@ module Gurke::Reporters
31
27
 
32
28
  io.print light_black(feature.description.gsub(/^/, ' '))
33
29
  io.puts
34
- io.puts
30
+ io.puts ' '
35
31
  end
36
32
 
37
33
  def before_scenario(scenario)
@@ -76,18 +72,18 @@ module Gurke::Reporters
76
72
 
77
73
  def retry_scenario(scenario)
78
74
  if scenario.flaky?
79
- io.print "\n Retry flaky scenario due to previous failure:\n\n"
75
+ io.print " \n Retry flaky scenario due to previous failure:\n \n"
80
76
  else
81
- io.print "\n Retry scenario due to previous failure:\n\n"
77
+ io.print " \n Retry scenario due to previous failure:\n \n"
82
78
  end
83
79
  end
84
80
 
85
81
  def after_scenario(*)
86
- io.puts
82
+ io.puts ' '
87
83
  end
88
84
 
89
85
  def after_feature(*)
90
- io.puts
86
+ io.puts ' '
91
87
  end
92
88
 
93
89
  def after_features(features)
@@ -112,7 +108,7 @@ module Gurke::Reporters
112
108
  io.puts green message
113
109
  end
114
110
 
115
- io.puts
111
+ io.puts ' '
116
112
  end
117
113
 
118
114
  protected
@@ -144,6 +140,7 @@ module Gurke::Reporters
144
140
 
145
141
  def print_exception(exception)
146
142
  io.puts red format_exception(exception).gsub(/^/, ' ')
143
+ io.print ' '
147
144
  end
148
145
 
149
146
  def format_location(obj)
@@ -155,12 +152,5 @@ module Gurke::Reporters
155
152
 
156
153
  light_black("# #{path}:#{line}")
157
154
  end
158
-
159
- %i[black red green yellow blue
160
- magenta cyan white default light_black
161
- light_red light_green light_yellow light_blue
162
- light_magenta light_cyan light_white].each do |color|
163
- define_method(color) {|str| io.tty? ? str.send(color) : str }
164
- end
165
155
  end
166
156
  end
data/lib/gurke/runner.rb CHANGED
@@ -16,7 +16,7 @@ module Gurke
16
16
  .map(&:capitalize)
17
17
  .join
18
18
 
19
- Reporters.const_get(r).new
19
+ Reporters.const_get(r).new(color: options[:color])
20
20
  end
21
21
  end
22
22
 
data/lib/gurke/version.rb CHANGED
@@ -3,8 +3,8 @@
3
3
  module Gurke
4
4
  module VERSION
5
5
  MAJOR = 3
6
- MINOR = 4
7
- PATCH = 0
6
+ MINOR = 5
7
+ PATCH = 1
8
8
  STAGE = nil
9
9
  STRING = [MAJOR, MINOR, PATCH, STAGE].compact.join('.').freeze
10
10
 
data/lib/gurke.rb CHANGED
@@ -23,6 +23,8 @@ module Gurke
23
23
  require 'gurke/world'
24
24
 
25
25
  module Reporters
26
+ require 'gurke/reporters/colored'
27
+
26
28
  require 'gurke/reporters/null_reporter'
27
29
  require 'gurke/reporters/compact_reporter'
28
30
  require 'gurke/reporters/default_reporter'
@@ -6,7 +6,7 @@ require 'spec_helper'
6
6
 
7
7
  RSpec.describe Gurke::Reporters::CompactReporter do
8
8
  subject(:out) do
9
- reporter = described_class.new(StringIO.new)
9
+ reporter = described_class.new(io: StringIO.new)
10
10
  reporter.send(*action)
11
11
  reporter.io.string
12
12
  end
@@ -127,20 +127,20 @@ RSpec.describe Gurke::Reporters::CompactReporter do
127
127
  end
128
128
 
129
129
  it do
130
- expect(out).to eq unindent <<~TEXT
131
- .E
132
- .Feature: Demo feature # features/file.feature:1
133
- . Scenario: Running the scenario # features/file.feature:5
134
- . Given the scenario is passing
135
- . RuntimeError: An error occurred
136
- . /path/to/file.rb:5:in `block (4 levels) in <top (required)>'
137
- . /path/to/file.rb:24:in in `fail_with'
138
- . caused by: IOError: Socket closed
139
- . script.rb:5:in `a'
140
- . script.rb:10:in `b'
141
- .
142
- .
143
- TEXT
130
+ expect(out).to eq text(
131
+ 'E',
132
+ 'Feature: Demo feature # features/file.feature:1',
133
+ ' Scenario: Running the scenario # features/file.feature:5',
134
+ ' Given the scenario is passing',
135
+ ' RuntimeError: An error occurred',
136
+ " /path/to/file.rb:5:in `block (4 levels) in <top (required)>'",
137
+ " /path/to/file.rb:24:in in `fail_with'",
138
+ ' caused by: IOError: Socket closed',
139
+ " script.rb:5:in `a'",
140
+ " script.rb:10:in `b'",
141
+ ' ',
142
+ '',
143
+ )
144
144
  end
145
145
  end
146
146
  end
@@ -187,12 +187,12 @@ RSpec.describe Gurke::Reporters::CompactReporter do
187
187
  let(:action) { [:after_features, []] }
188
188
 
189
189
  it do
190
- expect(out).to eq unindent <<~TEXT
191
- .
192
- .
193
- .0 scenarios: 0 passed, 0 failing, 0 pending
194
- .
195
- TEXT
190
+ expect(out).to eq text(
191
+ ' ',
192
+ ' ',
193
+ '0 scenarios: 0 passed, 0 failing, 0 pending',
194
+ '',
195
+ )
196
196
  end
197
197
  end
198
198
  end
@@ -6,11 +6,13 @@ require 'spec_helper'
6
6
 
7
7
  RSpec.describe Gurke::Reporters::DefaultReporter do
8
8
  subject(:out) do
9
- reporter = described_class.new(StringIO.new)
9
+ reporter = described_class.new(io: StringIO.new, color: color)
10
10
  reporter.send(*action)
11
11
  reporter.io.string
12
12
  end
13
13
 
14
+ let(:color) { nil }
15
+
14
16
  let(:feature) { instance_double(Gurke::Feature) }
15
17
  let(:scenario) { instance_double(Gurke::Scenario) }
16
18
  let(:step) { instance_double(Gurke::Step) }
@@ -28,14 +30,29 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
28
30
  end
29
31
 
30
32
  it do
31
- expect(out).to eq unindent <<~TEXT
32
- Feature: Demo feature # features/file.feature:1
33
- As a developer
34
- I would like have this spec passed
35
- In order to work on
36
- .
37
- .
38
- TEXT
33
+ expect(out).to eq text(
34
+ 'Feature: Demo feature # features/file.feature:1',
35
+ ' As a developer',
36
+ ' I would like have this spec passed',
37
+ ' In order to work on',
38
+ ' ',
39
+ '',
40
+ )
41
+ end
42
+
43
+ context 'with colors' do
44
+ let(:color) { true }
45
+
46
+ it 'outputs ASCII color codes' do
47
+ expect(out).to eq text(
48
+ "\e[0;33;49mFeature\e[0m: Demo feature \e[0;90;49m# features/file.feature:1\e[0m",
49
+ "\e[0;90;49m As a developer",
50
+ ' I would like have this spec passed',
51
+ " In order to work on\e[0m",
52
+ ' ',
53
+ '',
54
+ )
55
+ end
39
56
  end
40
57
  end
41
58
 
@@ -43,10 +60,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
43
60
  let(:action) { [:start_background, feature] }
44
61
 
45
62
  it do
46
- expect(out).to eq unindent <<~TEXT
47
- . Background:
48
- .
49
- TEXT
63
+ expect(out).to eq text(
64
+ ' Background:',
65
+ '',
66
+ )
50
67
  end
51
68
  end
52
69
 
@@ -59,10 +76,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
59
76
  end
60
77
 
61
78
  it do
62
- expect(out).to eq unindent <<~TEXT
63
- . Scenario: Running the scenario # features/file.feature:5
64
- .
65
- TEXT
79
+ expect(out).to eq text(
80
+ ' Scenario: Running the scenario # features/file.feature:5',
81
+ '',
82
+ )
66
83
  end
67
84
  end
68
85
 
@@ -74,9 +91,9 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
74
91
  end
75
92
 
76
93
  it do
77
- expect(out).to eq unindent <<~TEXT
78
- . Given the scenario is passing
79
- TEXT
94
+ expect(out).to eq text(
95
+ ' Given the scenario is passing',
96
+ )
80
97
  end
81
98
  end
82
99
 
@@ -92,10 +109,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
92
109
  let(:state) { :passed }
93
110
 
94
111
  it do
95
- expect(out).to eq unindent <<~TEXT
96
- . (passed)
97
- .
98
- TEXT
112
+ expect(out).to eq text(
113
+ ' (passed)',
114
+ '',
115
+ )
99
116
  end
100
117
  end
101
118
 
@@ -103,10 +120,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
103
120
  let(:state) { :pending }
104
121
 
105
122
  it do
106
- expect(out).to eq unindent <<~TEXT
107
- . (pending)
108
- .
109
- TEXT
123
+ expect(out).to eq text(
124
+ ' (pending)',
125
+ '',
126
+ )
110
127
  end
111
128
  end
112
129
 
@@ -114,10 +131,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
114
131
  let(:state) { nil }
115
132
 
116
133
  it do
117
- expect(out).to eq unindent <<~TEXT
118
- . (skipped)
119
- .
120
- TEXT
134
+ expect(out).to eq text(
135
+ ' (skipped)',
136
+ '',
137
+ )
121
138
  end
122
139
  end
123
140
 
@@ -142,17 +159,17 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
142
159
  end
143
160
 
144
161
  it do
145
- expect(out).to eq unindent <<~TEXT
146
- . (failure)
147
- . RuntimeError: An error occurred
148
- . /path/to/file.rb:5:in `block (4 levels) in <top (required)>'
149
- . /path/to/file.rb:24:in in `fail_with'
150
- . caused by: IOError: Socket closed
151
- . script.rb:5:in `a'
152
- . script.rb:10:in `b'
153
- .
154
- .
155
- TEXT
162
+ expect(out).to eq text(
163
+ ' (failure)',
164
+ ' RuntimeError: An error occurred',
165
+ " /path/to/file.rb:5:in `block (4 levels) in <top (required)>'",
166
+ " /path/to/file.rb:24:in in `fail_with'",
167
+ ' caused by: IOError: Socket closed',
168
+ " script.rb:5:in `a'",
169
+ " script.rb:10:in `b'",
170
+ ' ',
171
+ '',
172
+ )
156
173
  end
157
174
  end
158
175
  end
@@ -166,12 +183,12 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
166
183
  end
167
184
 
168
185
  it do
169
- expect(out).to eq unindent <<~TEXT
170
- .
171
- . Retry scenario due to previous failure:
172
- .
173
- .
174
- TEXT
186
+ expect(out).to eq text(
187
+ ' ',
188
+ ' Retry scenario due to previous failure:',
189
+ ' ',
190
+ '',
191
+ )
175
192
  end
176
193
  end
177
194
 
@@ -181,12 +198,12 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
181
198
  end
182
199
 
183
200
  it do
184
- expect(out).to eq unindent <<~TEXT
185
- .
186
- . Retry flaky scenario due to previous failure:
187
- .
188
- .
189
- TEXT
201
+ expect(out).to eq text(
202
+ ' ',
203
+ ' Retry flaky scenario due to previous failure:',
204
+ ' ',
205
+ '',
206
+ )
190
207
  end
191
208
  end
192
209
  end
@@ -195,10 +212,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
195
212
  let(:action) { [:after_scenario, scenario] }
196
213
 
197
214
  it do
198
- expect(out).to eq unindent <<~TEXT
199
- .
200
- .
201
- TEXT
215
+ expect(out).to eq text(
216
+ ' ',
217
+ '',
218
+ )
202
219
  end
203
220
  end
204
221
 
@@ -206,10 +223,10 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
206
223
  let(:action) { [:after_feature, feature] }
207
224
 
208
225
  it do
209
- expect(out).to eq unindent <<~TEXT
210
- .
211
- .
212
- TEXT
226
+ expect(out).to eq text(
227
+ ' ',
228
+ '',
229
+ )
213
230
  end
214
231
  end
215
232
 
@@ -217,11 +234,11 @@ RSpec.describe Gurke::Reporters::DefaultReporter do
217
234
  let(:action) { [:after_features, []] }
218
235
 
219
236
  it do
220
- expect(out).to eq unindent <<~TEXT
221
- .0 scenarios: 0 failing, 0 pending
222
- .
223
- .
224
- TEXT
237
+ expect(out).to eq text(
238
+ '0 scenarios: 0 failing, 0 pending',
239
+ ' ',
240
+ '',
241
+ )
225
242
  end
226
243
  end
227
244
  end
@@ -6,7 +6,7 @@ require 'spec_helper'
6
6
 
7
7
  RSpec.describe Gurke::Reporters::TeamCityReporter do
8
8
  subject(:statements) do
9
- reporter = described_class.new(StringIO.new)
9
+ reporter = described_class.new(io: StringIO.new)
10
10
  reporter.send(*action)
11
11
  reporter.io.string.scan(/##teamcity\[.*\]/)
12
12
  end
data/spec/spec_helper.rb CHANGED
@@ -18,6 +18,10 @@ module Helper
18
18
  def unindent(str)
19
19
  str.rstrip.gsub(/^\./, '')
20
20
  end
21
+
22
+ def text(*args)
23
+ args.join("\n")
24
+ end
21
25
  end
22
26
 
23
27
  RSpec.configure do |config|
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gurke
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-28 00:00:00.000000000 Z
10
+ date: 2025-04-09 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: colorize
@@ -38,21 +37,6 @@ dependencies:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
39
  version: '2.0'
41
- - !ruby/object:Gem::Dependency
42
- name: optimist
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '3.0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '3.0'
55
- description:
56
40
  email:
57
41
  - jgraichen@altimos.de
58
42
  executables:
@@ -90,6 +74,7 @@ files:
90
74
  - lib/gurke/feature.rb
91
75
  - lib/gurke/feature_list.rb
92
76
  - lib/gurke/reporter.rb
77
+ - lib/gurke/reporters/colored.rb
93
78
  - lib/gurke/reporters/compact_reporter.rb
94
79
  - lib/gurke/reporters/default_reporter.rb
95
80
  - lib/gurke/reporters/null_reporter.rb
@@ -118,7 +103,6 @@ licenses:
118
103
  - MIT
119
104
  metadata:
120
105
  rubygems_mfa_required: 'true'
121
- post_install_message:
122
106
  rdoc_options: []
123
107
  require_paths:
124
108
  - lib
@@ -133,8 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
117
  - !ruby/object:Gem::Version
134
118
  version: '0'
135
119
  requirements: []
136
- rubygems_version: 3.5.17
137
- signing_key:
120
+ rubygems_version: 3.6.2
138
121
  specification_version: 4
139
122
  summary: An alternative gherkin feature runner inspired by rspec and turnip.
140
123
  test_files: []