gurke 3.3.5 → 3.4.0

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: 322a0da4f1144d8731c128defb26359658b933496b2f7033123e413cb754a74c
4
- data.tar.gz: 6d14692f0061b371be67376920f3c5f76a8adc3dd8cc6a01b84dbe8d5796ea73
3
+ metadata.gz: b6701a22fdedaffd847fa2cb45077bed6d3bbbf7f6c1faf996a9908bac7ca335
4
+ data.tar.gz: 621bf975bcaf87268a5f98e28b7a15830820d4eef866fcccc74766c15ceecbf8
5
5
  SHA512:
6
- metadata.gz: e9daef2468e65bd5df367479f6ab74ca0b492e9093f9984e4d7847fdb8e71d73fcea728e123593d09825967ee1ac41ef7b0abe03f2516d5f8edbd92938cf6749
7
- data.tar.gz: 8c39e5a7be118c60a9c9a9996d7e2982b570640490d0d7e3e4f56bde0930507363343268360011cc3c85d563457f671c4734c8889c8b125f68c9e467056a3d43
6
+ metadata.gz: 3933d5b317b1da87502c1c171b39e48975184720ae9924196c6e05ddfbf922b26ec75c5ce39df087d4a9e51e5f331ec60c435a3bc81bcb31d0166e2ebe8369d4
7
+ data.tar.gz: 4e2d338ef6266709da78fd237906e20cd49839d4e0e55e4005251815b4802924d35436841e15a5b48ea13793dedf1876ce9b9ef157b62c934a0fdb00cb2fe5c5
data/CHANGELOG.md CHANGED
@@ -1,75 +1,158 @@
1
1
  # Changelog
2
2
 
3
- ## 3.3.5
3
+ All notable changes to this project will be documented in this file.
4
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`
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9
7
 
10
- ## 3.3.4
8
+ ## [Unreleased]
11
9
 
12
- * Replace renamed trollop dependency with optimist
10
+ ## [3.4.0] - 2024-08-28
13
11
 
14
- ## 3.3.3
12
+ ### Added
15
13
 
16
- * Fix a TC reporter issues reporting all scenarios as aborted
14
+ - Support expectations in step hooks
17
15
 
18
- ## 3.3.2
16
+ ## [3.3.5] - 2023-10-28
19
17
 
20
- * Fix teamcity and compact reporter
18
+ ### Changed
21
19
 
22
- ## 3.3.1
20
+ - Test with Ruby 2.7, 3.0, 3.1, and 3.2
21
+ - Upgrade to Ruby 2.7+
22
+ - Fix required `StringIO` usage
23
+ - Fix `send :include`
23
24
 
24
- * Add option for default retry of failed scenarios
25
- * Make number of default and flaky retries configurable
25
+ ## [3.3.4] - 2018-10-26
26
26
 
27
- ## 3.2.2
27
+ ### Changed
28
28
 
29
- * Fix some default reporter formatting issues
29
+ - Replace renamed trollop dependency with optimist
30
30
 
31
- ## 3.2.1
31
+ ## [3.3.3] - 2018-07-27
32
32
 
33
- * Reset world between retried scenario runs
33
+ ### Changed
34
34
 
35
- ## 3.2.0
35
+ - Fix a TC reporter issues reporting all scenarios as aborted
36
36
 
37
- * Add @flaky tag support for retrying flaky scenarios once
37
+ ## [3.3.2] - 2018-07-27
38
38
 
39
- ## 3.1.0
39
+ ### Changed
40
40
 
41
- * Update TeamCity formatter to extend default formatter
41
+ - Fix TeamCity and compact reporter
42
42
 
43
- ## 3.0.0
43
+ ## [3.3.1] - 2018-07-26
44
44
 
45
- * Drop support for MRI < 2.3
45
+ ### Changed
46
46
 
47
- ## 2.3.0
47
+ - Add option for default retry of failed scenarios
48
+ - Make number of default and flaky retries configurable
48
49
 
49
- * Step inclusion can be scoped to specific tags (45cea9ab)
50
+ ## [3.2.2] - 2018-04-11
50
51
 
51
- ## 2.2.2
52
+ ### Changed
52
53
 
53
- * TeamCityReporter: Fixing mark test as pending
54
+ - Fix some default reporter formatting issues
54
55
 
55
- ## 2.2.1
56
+ ## [3.2.1] - 2018-04-11
56
57
 
57
- * BugFix (missing argument in cli.rb)
58
- * BugFix in after_feature hook call (missing feature argument)
58
+ ### Changed
59
59
 
60
- ## 2.2.0
60
+ - Reset world between retried scenario runs
61
61
 
62
- + Support executing all features inside one directory
63
- + Support reporter selection via cli
64
- + Add TeamCityReporter (`gurke --formatter team_city`)
65
- * Support string as step definitions correctly
66
- * Smaller bugfix in improved exception formatting
62
+ ## [3.2.0] - 2018-04-11
67
63
 
64
+ ### Changed
68
65
 
69
- ## 2.1.0
66
+ - Add `@flaky` tag support for retrying flaky scenarios once
70
67
 
71
- * Improve exception formating
68
+ ## [3.1.0] - 2018-02-26
72
69
 
73
- ## 2.0.0
70
+ ### Changed
74
71
 
75
- * Project start
72
+ - Update TeamCity formatter to extend default formatter
73
+
74
+ ## [3.0.0] - 2018-02-26
75
+
76
+ ### Changed
77
+
78
+ - Drop support for MRI < 2.3
79
+
80
+ ## [2.4.2] - 2016-05-10
81
+
82
+ ## [2.4.1] - 2016-02-10
83
+
84
+ ## [2.4.0] - 2015-05-28
85
+
86
+ ## [2.3.0] - 2014-02-26
87
+
88
+ ### Changed
89
+
90
+ - Step inclusion can be scoped to specific tags (45cea9ab)
91
+
92
+ ## [2.2.2] - 2014-07-02
93
+
94
+ ### Changed
95
+
96
+ - `TeamCityReporter`: Fixing mark test as pending
97
+
98
+ ## [2.2.1] - 2014-06-27
99
+
100
+ ### Changed
101
+
102
+ - Bug fix (missing argument in `cli.rb`)
103
+ - Bug fix in after_feature hook call (missing feature argument)
104
+
105
+ ## [2.2.0] - 2014-06-27
106
+
107
+ ### Changed
108
+
109
+ - Support executing all features inside one directory
110
+ - Support reporter selection via CLI
111
+ - Add `TeamCityReporter` (`gurke --formatter team_city`)
112
+ - Support string as step definitions correctly
113
+ - Smaller bug fix in improved exception formatting
114
+
115
+ ## [2.1.0] - 2014-06-27
116
+
117
+ ### Changed
118
+
119
+ - Improve exception formatting
120
+
121
+ ## [2.0.3] - 2014-06-24
122
+
123
+ ## [2.0.2] - 2014-06-24
124
+
125
+ ## [2.0.1] - 2014-06-18
126
+
127
+ ## [2.0.0] - 2014-06-06
128
+
129
+ ## [1.0.1] - 2014-01-22
130
+
131
+ ## [1.0.0] - 2013-12-04
132
+
133
+ [Unreleased]: https://github.com/jgraichen/gurke/compare/v3.4.0...HEAD
134
+ [3.4.0]: https://github.com/jgraichen/gurke/compare/v3.3.5...v3.4.0
135
+ [3.3.5]: https://github.com/jgraichen/gurke/compare/v3.3.4...v3.3.5
136
+ [3.3.4]: https://github.com/jgraichen/gurke/compare/v3.3.3...v3.3.4
137
+ [3.3.3]: https://github.com/jgraichen/gurke/compare/v3.3.2...v3.3.3
138
+ [3.3.2]: https://github.com/jgraichen/gurke/compare/v3.3.1...v3.3.2
139
+ [3.3.1]: https://github.com/jgraichen/gurke/compare/v3.2.2...v3.3.1
140
+ [3.2.2]: https://github.com/jgraichen/gurke/compare/v3.2.1...v3.2.2
141
+ [3.2.1]: https://github.com/jgraichen/gurke/compare/v3.2.0...v3.2.1
142
+ [3.2.0]: https://github.com/jgraichen/gurke/compare/v3.1.0...v3.2.0
143
+ [3.1.0]: https://github.com/jgraichen/gurke/compare/v3.0.0...v3.1.0
144
+ [3.0.0]: https://github.com/jgraichen/gurke/compare/v2.4.2...v3.0.0
145
+ [2.4.2]: https://github.com/jgraichen/gurke/compare/v2.4.1...v2.4.2
146
+ [2.4.1]: https://github.com/jgraichen/gurke/compare/v2.4.0...v2.4.1
147
+ [2.4.0]: https://github.com/jgraichen/gurke/compare/v2.3.0...v2.4.0
148
+ [2.3.0]: https://github.com/jgraichen/gurke/compare/v2.2.2...v2.3.0
149
+ [2.2.2]: https://github.com/jgraichen/gurke/compare/v2.2.1...v2.2.2
150
+ [2.2.1]: https://github.com/jgraichen/gurke/compare/v2.2.0...v2.2.1
151
+ [2.2.0]: https://github.com/jgraichen/gurke/compare/v2.1.0...v2.2.0
152
+ [2.1.0]: https://github.com/jgraichen/gurke/compare/v2.0.3...v2.1.0
153
+ [2.0.3]: https://github.com/jgraichen/gurke/compare/v2.0.2...v2.0.3
154
+ [2.0.2]: https://github.com/jgraichen/gurke/compare/v2.0.1...v2.0.2
155
+ [2.0.1]: https://github.com/jgraichen/gurke/compare/v2.0.0...v2.0.1
156
+ [2.0.0]: https://github.com/jgraichen/gurke/compare/v1.0.1...v2.0.0
157
+ [1.0.1]: https://github.com/jgraichen/gurke/compare/v1.0.0...v1.0.1
158
+ [1.0.0]: https://github.com/jgraichen/gurke/tree/v1.0.0
data/gurke.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.homepage = 'https://github.com/jgraichen/gurke'
13
13
  spec.license = 'MIT'
14
14
 
15
- spec.summary = \
15
+ spec.summary =
16
16
  'An alternative gherkin feature runner inspired by rspec and turnip.'
17
17
 
18
18
  spec.metadata['rubygems_mfa_required'] = 'true'
data/lib/gurke/feature.rb CHANGED
@@ -65,7 +65,7 @@ module Gurke
65
65
 
66
66
  def self.new(*args)
67
67
  if args.size == 1 && (f = args.first).is_a?(self)
68
- super f.file, f.line, f.tags, f.raw
68
+ super(f.file, f.line, f.tags, f.raw)
69
69
  else
70
70
  super
71
71
  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 # rubocop:disable Style/DocumentDynamicEvalDefinition
9
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1 # rubocop:disable Style/DocumentDynamicEvalDefinition
10
10
  def #{cb}(*) end
11
11
  RUBY
12
12
  end
@@ -200,16 +200,7 @@ module Gurke
200
200
  end
201
201
 
202
202
  def world
203
- @world ||= begin
204
- cls = Class.new
205
- cls.send :include, Gurke.world
206
-
207
- Gurke.config.inclusions.each do |incl|
208
- cls.send :include, incl.mod if incl.match?(tag_names)
209
- end
210
- cls.send :include, Gurke::Steps
211
- cls.new
212
- end
203
+ @world ||= Gurke::World.create(tag_names: tag_names)
213
204
  end
214
205
  end
215
206
  end
data/lib/gurke/step.rb CHANGED
@@ -46,19 +46,18 @@ module Gurke
46
46
  def run(runner, reporter, scenario, world)
47
47
  reporter.invoke :before_step, self, scenario
48
48
 
49
- result = runner.hook(:step, self, world) do
50
- run_step runner, reporter, scenario, world
49
+ run_step(runner, reporter, scenario, world).tap do |result|
50
+ reporter.invoke :after_step, result, scenario
51
51
  end
52
-
53
- reporter.invoke :after_step, result, scenario
54
52
  end
55
53
 
56
54
  private
57
55
 
58
56
  def run_step(runner, reporter, scenario, world)
59
- reporter.invoke :start_step, self, scenario
60
-
61
- result = find_and_run_step runner, scenario, world
57
+ result = runner.hook(:step, self, world) do
58
+ reporter.invoke :start_step, self, scenario
59
+ find_and_run_step runner, scenario, world
60
+ end
62
61
  rescue Interrupt
63
62
  scenario.abort!
64
63
  result = StepResult.new self, scenario, :aborted
data/lib/gurke/version.rb CHANGED
@@ -3,8 +3,8 @@
3
3
  module Gurke
4
4
  module VERSION
5
5
  MAJOR = 3
6
- MINOR = 3
7
- PATCH = 5
6
+ MINOR = 4
7
+ PATCH = 0
8
8
  STAGE = nil
9
9
  STRING = [MAJOR, MINOR, PATCH, STAGE].compact.join('.').freeze
10
10
 
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gurke
4
+ module World
5
+ class << self
6
+ def create(tag_names: [])
7
+ Class.new.tap do |cls|
8
+ cls.send :include, Gurke.world
9
+
10
+ Gurke.config.inclusions.each do |incl|
11
+ cls.send :include, incl.mod if incl.match?(tag_names)
12
+ end
13
+
14
+ cls.send :include, Gurke::Steps
15
+ end.new
16
+ end
17
+ end
18
+ end
19
+ end
data/lib/gurke.rb CHANGED
@@ -20,6 +20,7 @@ module Gurke
20
20
  require 'gurke/steps'
21
21
  require 'gurke/step_definition'
22
22
  require 'gurke/reporter'
23
+ require 'gurke/world'
23
24
 
24
25
  module Reporters
25
26
  require 'gurke/reporters/null_reporter'
@@ -61,7 +62,7 @@ module Gurke
61
62
 
62
63
  # @api private
63
64
  def world
64
- @world ||= const_set(:World, Module.new)
65
+ @world ||= World
65
66
  end
66
67
  end
67
68
  end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Gurke::Step do
6
+ let(:step) do
7
+ described_class.new('./fake.feature', 1337, :when, raw)
8
+ end
9
+
10
+ let(:reporter) { instance_double Gurke::Reporters::NullReporter }
11
+ let(:runner) { instance_double Gurke::Runner }
12
+ let(:scenario) { instance_double Gurke::Scenario }
13
+ let(:raw) { instance_double Gherkin::Formatter::Model::Step }
14
+ let(:world) { Gurke::World.create }
15
+
16
+ before do
17
+ world.class.When 'I run something' do
18
+ true
19
+ end
20
+
21
+ allow(raw).to receive(:name).and_return('I run something')
22
+ allow(reporter).to receive(:invoke)
23
+ allow(runner).to receive(:hook) {|_, _, &block| block.call }
24
+ allow(runner).to receive(:with_filtered_backtrace) {|*, &block| block.call }
25
+ allow(scenario).to receive_messages(pending?: false, failed?: false, aborted?: false)
26
+ end
27
+
28
+ describe '#run' do
29
+ subject(:result) { step.run(runner, reporter, scenario, world) }
30
+
31
+ it 'passes the step' do
32
+ expect(result).to be_passed
33
+ end
34
+
35
+ context 'with exception in after step hook' do
36
+ before do
37
+ allow(scenario).to receive(:failed!)
38
+
39
+ allow(runner).to receive(:hook) do |_, _, &block|
40
+ block.call
41
+ raise exception
42
+ end
43
+ end
44
+
45
+ let(:exception) { RuntimeError.new('faily') }
46
+
47
+ it 'fails the step' do
48
+ expect(result).to be_failed
49
+ expect(scenario).to have_received(:failed!)
50
+ .with(exception)
51
+ end
52
+ end
53
+
54
+ context 'with exception in before step hook' do
55
+ before do
56
+ allow(scenario).to receive(:failed!)
57
+
58
+ allow(runner).to receive(:hook) do
59
+ raise exception
60
+ end
61
+ end
62
+
63
+ let(:exception) { RuntimeError.new('faily') }
64
+
65
+ it 'fails the step' do
66
+ expect(result).to be_failed
67
+ expect(scenario).to have_received(:failed!)
68
+ .with(exception)
69
+ end
70
+ end
71
+ end
72
+ end
data/spec/spec_helper.rb CHANGED
@@ -2,12 +2,13 @@
2
2
 
3
3
  require 'rspec'
4
4
  require 'simplecov'
5
- SimpleCov.start
5
+ require 'simplecov-cobertura'
6
6
 
7
- if ENV['CI']
8
- require 'codecov'
9
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
10
- end
7
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
8
+ SimpleCov::Formatter::HTMLFormatter,
9
+ SimpleCov::Formatter::CoberturaFormatter,
10
+ ])
11
+ SimpleCov.start
11
12
 
12
13
  require 'gurke'
13
14
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gurke
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.5
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Graichen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-28 00:00:00.000000000 Z
11
+ date: 2024-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -103,6 +103,7 @@ files:
103
103
  - lib/gurke/steps.rb
104
104
  - lib/gurke/tag.rb
105
105
  - lib/gurke/version.rb
106
+ - lib/gurke/world.rb
106
107
  - spec/gurke/feature_list_spec.rb
107
108
  - spec/gurke/reporters/compact_reporter_spec.rb
108
109
  - spec/gurke/reporters/default_reporter_spec.rb
@@ -110,6 +111,7 @@ files:
110
111
  - spec/gurke/run_list_spec.rb
111
112
  - spec/gurke/scenario_spec.rb
112
113
  - spec/gurke/step_definition_spec.rb
114
+ - spec/gurke/step_spec.rb
113
115
  - spec/spec_helper.rb
114
116
  homepage: https://github.com/jgraichen/gurke
115
117
  licenses:
@@ -131,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
133
  - !ruby/object:Gem::Version
132
134
  version: '0'
133
135
  requirements: []
134
- rubygems_version: 3.4.21
136
+ rubygems_version: 3.5.17
135
137
  signing_key:
136
138
  specification_version: 4
137
139
  summary: An alternative gherkin feature runner inspired by rspec and turnip.