turnip 4.3.0 → 4.4.1

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: 8a5b2f61d3782f307c76f247b14f6a814c9b23e756ed5a1ebdb2d5f1261454af
4
- data.tar.gz: d4d5876e9b484995c2883448e4b302d68ec14094e52dde6d78c5b99232d801a1
3
+ metadata.gz: 858d3655d11832f0679cd4ef003f9ee9c88a17df303736bc3117caffc8cc62a0
4
+ data.tar.gz: 32c308e81c49dacfed48ca6d09a035d0f243b959ac289ba8d89cff27192d44ce
5
5
  SHA512:
6
- metadata.gz: 8b433ce756fb3c6430c1544e9b94acf5a36ad5de1607ad71824961be0fa313907f2d05f1cb55102d424935a8f311cd99045c0d6bec039edb997f51418fab6b9d
7
- data.tar.gz: c30109444ccc7b315b98db85a4f24bbd31082289d35a4a6930d8c657adcc278e6bd8d1420082d6061a8f61fe10cae461a8d6e56a6ea0347eb9917d9e110ab1ce
6
+ metadata.gz: 824c0258f5cbfbfee5609cf27c60d3e2793f84889a2b1b99c0a7bd3839b59b554daeb2272a0b9bb42388a31f88d63558d747c7929f54625b0b8fb8d271a7bd04
7
+ data.tar.gz: a57d0d377021932476f7f5e9ea4272ac3a82135f75e93df0b8d9021f63870fb0c8d6f947422a9ecd18cf799305170adc973b9a65cadc6f931238d1616c6aa080
data/.envrc ADDED
@@ -0,0 +1 @@
1
+ use flake
@@ -6,13 +6,13 @@ jobs:
6
6
  fail-fast: false
7
7
  matrix:
8
8
  ruby:
9
- - '2.5'
10
- - '2.6'
11
9
  - '2.7'
10
+ - '3.0'
11
+ - '3.1'
12
12
  - jruby
13
13
  gemfiles:
14
- - gemfiles/Gemfile-rspec-3.9.x
15
- - gemfiles/Gemfile-rspec-3.10.x
14
+ - gemfiles/Gemfile-rspec-3.11.x
15
+ - gemfiles/Gemfile-rspec-3.12.x
16
16
  runs-on: ubuntu-latest
17
17
  steps:
18
18
  - uses: actions/checkout@v2
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.2
data/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [4.4.1] - 2024-08-09
6
+
7
+ ### Fixed
8
+
9
+ - Fix tags on scenario outline [[GH-252](https://github.com/jnicklas/turnip/pull/252)]
10
+
11
+ ## [4.4.0] - 2022-11-04
12
+
13
+ ### Added
14
+
15
+ - Add CukeModeler as Gherkin abstraction layer [[GH-244](https://github.com/jnicklas/turnip/pull/244)]
16
+ - Send step notifications and add metadata for RSpec reporter [[GH-249](https://github.com/jnicklas/turnip/pull/249)]
17
+
18
+ ### Fixed
19
+
20
+ - Add "missing step" context when raising error for unimplemented steps [[GH-240](https://github.com/jnicklas/turnip/pull/240)]
21
+ - Support rspec 3.11 and 3.12 and deprecate EOL rubies [[GH-250](https://github.com/jnicklas/turnip/pull/250)]
22
+
5
23
  ## [4.3.0] - 2021-05-16
6
24
 
7
25
  ### Added
data/README.md CHANGED
@@ -48,8 +48,10 @@ Please create a topic branch for every separate change you make.
48
48
 
49
49
  ### 1. Ruby
50
50
 
51
- - Support Ruby 2.5 or higher
52
- - Does not support Ruby (or does not work) 2.4.X or earlier
51
+ Supports Non-EOL Rubies:
52
+
53
+ - Support Ruby 2.7 or higher
54
+ - Does not support Ruby (or does not work) 2.6.X or earlier
53
55
 
54
56
  ### 2. RSpec
55
57
 
@@ -255,7 +257,7 @@ Before loading your `spec_helper`, Turnip also tries to load a file called
255
257
  You might find it beneficial to load your steps from this file so that they
256
258
  don't have to be loaded when you run your other tests.
257
259
 
258
- If you use Turnip with [rspec-rails](https://github.com/rspec/rspec-rails) v3.x, most configuration written to `rails_helper.rb` but not `spec_helper.rb`. So you should write to `turnip_helper` like this:
260
+ If you use Turnip with [rspec-rails](https://github.com/rspec/rspec-rails), most configuration written to `rails_helper.rb` but not `spec_helper.rb`. So you should write to `turnip_helper` like this:
259
261
 
260
262
  ```ruby
261
263
  require 'rails_helper'
@@ -440,7 +442,7 @@ end
440
442
  Turnip mark a scenario as pending when steps in the scenario is not implemented.
441
443
  If you sets `raise_error_for_unimplemented_steps` as `true`, turnip will mark a scenario as fail.
442
444
 
443
- It defaults to `false`, you can change it by following configuration:
445
+ It defaults to `false`, you can change it by adding following configuration to `spec/turnip_helper.rb`:
444
446
 
445
447
  ```ruby
446
448
  RSpec.configure do |config|
@@ -476,6 +478,24 @@ tags you'd use in Cucumber to switch between drivers e.g. `@javascript` or
476
478
  metadata, so that Capybara is included and also any other extensions you might
477
479
  want to add.
478
480
 
481
+ ## RSpec custom formatters
482
+
483
+ Turnip sends notifications to the RSpec reporter about step progress. You can
484
+ listen for these by registering your formatter class with the following
485
+ notifications:
486
+
487
+ ``` ruby
488
+ class MyFormatter
489
+ RSpec::Core::Formatters.register self, :step_started, :step_passed, :step_failed, :step_pending
490
+
491
+ def step_passed(step)
492
+ puts "Starting step: #{step.text}"
493
+ end
494
+
495
+ # …
496
+ end
497
+ ```
498
+
479
499
  ## License
480
500
 
481
501
  (The MIT License)
@@ -0,0 +1,5 @@
1
+ # language: en-au
2
+
3
+ Pretty much: A feature that specifies a language
4
+ Awww, look mate: This is a language specific feature
5
+ * a step
@@ -12,3 +12,15 @@ Feature: With tags
12
12
  When I attack it
13
13
  And I attack it
14
14
  Then it should die
15
+
16
+ @variety
17
+ Scenario Outline: With tag on scenario outline
18
+ Given there is a <Monster Type> monster
19
+ When I attack it
20
+ And I attack it
21
+ Then it should die
22
+
23
+ Examples:
24
+ | Monster Type |
25
+ | weak |
26
+ | strong |
data/flake.lock ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "nodes": {
3
+ "nixpkgs": {
4
+ "locked": {
5
+ "lastModified": 1697723726,
6
+ "narHash": "sha256-SaTWPkI8a5xSHX/rrKzUe+/uVNy6zCGMXgoeMb7T9rg=",
7
+ "path": "/nix/store/4jfc6vrkmq7z5pb651jh5b4kra5f1kwp-source",
8
+ "rev": "7c9cc5a6e5d38010801741ac830a3f8fd667a7a0",
9
+ "type": "path"
10
+ },
11
+ "original": {
12
+ "id": "nixpkgs",
13
+ "type": "indirect"
14
+ }
15
+ },
16
+ "root": {
17
+ "inputs": {
18
+ "nixpkgs": "nixpkgs"
19
+ }
20
+ }
21
+ },
22
+ "root": "root",
23
+ "version": 7
24
+ }
data/flake.nix ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ description = "Ruby dev environment";
3
+
4
+ inputs = { };
5
+
6
+ outputs = { self, nixpkgs }:
7
+ let
8
+ # Helper to provide system-specific attributes
9
+ forAllSupportedSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
10
+ pkgs = import nixpkgs { inherit system; };
11
+ });
12
+
13
+ supportedSystems = [
14
+ "aarch64-darwin"
15
+ "aarch64-linux"
16
+ "x86_64-darwin"
17
+ "x86_64-linux"
18
+ ];
19
+ in
20
+
21
+ {
22
+ devShells = forAllSupportedSystems ({ pkgs }: {
23
+ default = pkgs.mkShell {
24
+ packages = with pkgs; [
25
+ ruby_3_2
26
+ ];
27
+ };
28
+ });
29
+ };
30
+ }
@@ -3,5 +3,5 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in turnip.gemspec
4
4
  gemspec :path => '..'
5
5
 
6
- gem 'rspec', '~> 3.10.0'
6
+ gem 'rspec', '~> 3.11.0'
7
7
  gem 'pry-byebug', platforms: :mri
@@ -3,5 +3,5 @@ source "https://rubygems.org"
3
3
  # Specify your gem's dependencies in turnip.gemspec
4
4
  gemspec :path => '..'
5
5
 
6
- gem 'rspec', '~> 3.9.0'
6
+ gem 'rspec', '~> 3.12.0'
7
7
  gem 'pry-byebug', platforms: :mri
@@ -1,19 +1,13 @@
1
- require "gherkin"
1
+ require "cuke_modeler"
2
2
  require 'turnip/node/feature'
3
3
 
4
4
  module Turnip
5
5
  class Builder
6
6
  def self.build(feature_file)
7
- messages = Gherkin.from_paths(
8
- [feature_file],
9
- include_source: false,
10
- include_gherkin_document: true,
11
- include_pickles: false
12
- )
13
- result = messages.first&.gherkin_document&.to_hash
7
+ feature_file = CukeModeler::FeatureFile.new(feature_file)
14
8
 
15
- return nil if result.nil? || result[:feature].nil?
16
- Node::Feature.new(result[:feature])
9
+ return nil unless feature_file.feature
10
+ Node::Feature.new(feature_file.feature)
17
11
  end
18
12
  end
19
13
  end
@@ -20,15 +20,15 @@ module Turnip
20
20
  include HasTags
21
21
 
22
22
  def keyword
23
- @raw[:keyword]
23
+ @raw.keyword
24
24
  end
25
25
 
26
26
  def name
27
- @raw[:name]
27
+ @raw.name
28
28
  end
29
29
 
30
30
  def description
31
- @raw[:description]
31
+ @raw.description
32
32
  end
33
33
 
34
34
  #
@@ -42,7 +42,7 @@ module Turnip
42
42
  # @return [Array]
43
43
  #
44
44
  def header
45
- @header ||= @raw[:table_header][:cells].map { |c| c[:value] }
45
+ @header ||= @raw.parameter_row.cells.map { |c| c.value }
46
46
  end
47
47
 
48
48
  #
@@ -56,8 +56,8 @@ module Turnip
56
56
  # @return [Array]
57
57
  #
58
58
  def rows
59
- @rows ||= @raw[:table_body].map do |row|
60
- row[:cells].map { |c| c[:value] }
59
+ @rows ||= @raw.argument_rows.map do |row|
60
+ row.cells.map { |c| c.value }
61
61
  end
62
62
  end
63
63
  end
@@ -23,22 +23,25 @@ module Turnip
23
23
  include HasTags
24
24
 
25
25
  def language
26
- @raw[:language]
26
+ @raw.language
27
27
  end
28
28
 
29
29
  def children
30
- @children ||= @raw[:children].map do |child|
31
- unless child[:background].nil?
32
- next Background.new(child[:background])
30
+ @children ||= @raw.children.map do |child|
31
+ if child.is_a?(CukeModeler::Background)
32
+ next Background.new(child)
33
33
  end
34
34
 
35
- unless child[:scenario].nil?
36
- klass = child.dig(:scenario, :examples).nil? ? Scenario : ScenarioOutline
37
- next klass.new(child[:scenario])
35
+ if child.is_a?(CukeModeler::Scenario)
36
+ next Scenario.new(child)
38
37
  end
39
38
 
40
- unless child[:rule].nil?
41
- next Rule.new(child[:rule])
39
+ if child.is_a?(CukeModeler::Outline)
40
+ next ScenarioOutline.new(child)
41
+ end
42
+
43
+ if child.is_a?(CukeModeler::Rule)
44
+ next Rule.new(child)
42
45
  end
43
46
  end.compact
44
47
  end
@@ -23,7 +23,7 @@ module Turnip
23
23
  # @return [Location]
24
24
  #
25
25
  def location
26
- @location ||= Location.new(@raw[:location][:line], @raw[:location][:column])
26
+ @location ||= Location.new(@raw.source_line, @raw.source_column)
27
27
  end
28
28
 
29
29
  def line
@@ -16,14 +16,17 @@ module Turnip
16
16
  #
17
17
  class Rule < ScenarioGroupDefinition
18
18
  def children
19
- @children ||= @raw[:children].map do |child|
20
- unless child[:background].nil?
21
- next Background.new(child[:background])
19
+ @children ||= @raw.children.map do |child|
20
+ if child.is_a?(CukeModeler::Background)
21
+ next Background.new(child)
22
22
  end
23
23
 
24
- unless child[:scenario].nil?
25
- klass = child.dig(:scenario, :examples).nil? ? Scenario : ScenarioOutline
26
- next klass.new(child[:scenario])
24
+ if child.is_a?(CukeModeler::Scenario)
25
+ next Scenario.new(child)
26
+ end
27
+
28
+ if child.is_a?(CukeModeler::Outline)
29
+ next ScenarioOutline.new(child)
27
30
  end
28
31
  end.compact
29
32
  end
@@ -5,19 +5,19 @@ module Turnip
5
5
  module Node
6
6
  class ScenarioDefinition < Base
7
7
  def name
8
- @raw[:name]
8
+ @raw.name
9
9
  end
10
10
 
11
11
  def keyword
12
- @raw[:keyword]
12
+ @raw.keyword
13
13
  end
14
14
 
15
15
  def description
16
- @raw[:description]
16
+ @raw.description
17
17
  end
18
18
 
19
19
  def steps
20
- @steps ||= @raw[:steps].map do |step|
20
+ @steps ||= @raw.steps.map do |step|
21
21
  Step.new(step)
22
22
  end
23
23
  end
@@ -7,15 +7,15 @@ module Turnip
7
7
  module Node
8
8
  class ScenarioGroupDefinition < Base
9
9
  def name
10
- @raw[:name]
10
+ @raw.name
11
11
  end
12
12
 
13
13
  def keyword
14
- @raw[:keyword]
14
+ @raw.keyword
15
15
  end
16
16
 
17
17
  def description
18
- @raw[:description]
18
+ @raw.description
19
19
  end
20
20
 
21
21
  def backgrounds
@@ -20,7 +20,7 @@ module Turnip
20
20
  include HasTags
21
21
 
22
22
  def examples
23
- @examples ||= @raw[:examples].map do |raw|
23
+ @examples ||= @raw.examples.map do |raw|
24
24
  Example.new(raw)
25
25
  end
26
26
  end
@@ -57,27 +57,27 @@ module Turnip
57
57
  header = example.header
58
58
 
59
59
  example.rows.map do |row|
60
- metadata = convert_metadata_to_scenario(header, row)
60
+ scenario = convert_metadata_to_scenario(header, row)
61
61
 
62
62
  #
63
63
  # Replace <placeholder> using Example values
64
64
  #
65
- metadata[:steps].each do |step|
66
- step[:text] = substitute(step[:text], header, row)
65
+ scenario.steps.each do |step|
66
+ step.text = substitute(step.text, header, row)
67
67
 
68
68
  case
69
- when step[:doc_string]
70
- step[:doc_string][:content] = substitute(step[:doc_string][:content], header, row)
71
- when step[:data_table]
72
- step[:data_table][:rows].map do |table_row|
73
- table_row[:cells].map do |cell|
74
- cell[:value] = substitute(cell[:value], header, row)
69
+ when step.block&.is_a?(CukeModeler::DocString)
70
+ step.block.content = substitute(step.block.content, header, row)
71
+ when step.block&.is_a?(CukeModeler::Table)
72
+ step.block.rows.map do |table_row|
73
+ table_row.cells.map do |cell|
74
+ cell.value = substitute(cell.value, header, row)
75
75
  end
76
76
  end
77
77
  end
78
78
  end
79
79
 
80
- Scenario.new(metadata)
80
+ Scenario.new(scenario)
81
81
  end
82
82
  end.flatten.compact
83
83
  end
@@ -117,11 +117,15 @@ module Turnip
117
117
  #
118
118
  def convert_metadata_to_scenario(header, row)
119
119
  # deep copy
120
- Marshal.load(Marshal.dump(raw)).tap do |new_raw|
121
- new_raw.delete(:examples)
122
- new_raw[:name] = substitute(new_raw[:name], header, row)
123
- new_raw[:type] = :Scenario
124
- new_raw[:keyword] = 'Scenario'
120
+ original = Marshal.load(Marshal.dump(raw))
121
+
122
+ CukeModeler::Scenario.new.tap do |scenario|
123
+ scenario.name = substitute(original.name, header, row)
124
+ scenario.keyword = 'Scenario' # TODO: Do we need to worry about dialects other than English?
125
+ scenario.steps = original.steps
126
+ scenario.source_line = original.source_line
127
+ scenario.source_column = original.source_column
128
+ scenario.tags = original.tags
125
129
  end
126
130
  end
127
131
 
@@ -16,11 +16,12 @@ module Turnip
16
16
  #
17
17
  class Step < Base
18
18
  def keyword
19
- @raw[:keyword]
19
+ # TODO: Do we want to keep the whitespace?
20
+ @raw.keyword + ' '
20
21
  end
21
22
 
22
23
  def text
23
- @raw[:text]
24
+ @raw.text
24
25
  end
25
26
 
26
27
  #
@@ -32,10 +33,10 @@ module Turnip
32
33
 
33
34
  def argument
34
35
  @argument ||= case
35
- when @raw[:doc_string]
36
- doc_string(@raw[:doc_string])
37
- when @raw[:data_table]
38
- data_table(@raw[:data_table])
36
+ when @raw.block&.is_a?(CukeModeler::DocString)
37
+ doc_string(@raw.block)
38
+ when @raw.block&.is_a?(CukeModeler::Table)
39
+ data_table(@raw.block)
39
40
  end
40
41
  end
41
42
 
@@ -46,13 +47,13 @@ module Turnip
46
47
  private
47
48
 
48
49
  def doc_string(doc)
49
- doc[:content]
50
+ doc.content
50
51
  end
51
52
 
52
53
  def data_table(table)
53
- rows = table[:rows].map do |row|
54
- row[:cells].map do |cell|
55
- cell[:value]
54
+ rows = table.rows.map do |row|
55
+ row.cells.map do |cell|
56
+ cell.value
56
57
  end
57
58
  end
58
59
  Turnip::Table.new(rows)
@@ -13,7 +13,7 @@ module Turnip
13
13
  #
14
14
  class Tag < Base
15
15
  def name
16
- @name ||= @raw[:name].gsub(/^@/, '')
16
+ @name ||= @raw.name.gsub(/^@/, '')
17
17
  end
18
18
  end
19
19
 
@@ -22,7 +22,7 @@ module Turnip
22
22
  # @return [Array] Array of Tag
23
23
  #
24
24
  def tags
25
- @tags ||= @raw.fetch(:tags, []).map do |tag|
25
+ @tags ||= @raw.tags.map do |tag|
26
26
  Tag.new(tag)
27
27
  end
28
28
  end
data/lib/turnip/rspec.rb CHANGED
@@ -40,25 +40,35 @@ module Turnip
40
40
  include Turnip::Execute
41
41
 
42
42
  def run_step(feature_file, step)
43
+ reporter = ::RSpec.current_example.reporter
44
+ reporter.publish(:step_started, { step: step })
45
+
43
46
  begin
44
47
  instance_eval <<-EOS, feature_file, step.line
45
48
  step(step)
46
49
  EOS
47
50
  rescue Turnip::Pending => e
51
+ reporter.publish(:step_pending, { step: step })
52
+
48
53
  example = ::RSpec.current_example
49
54
  example.metadata[:line_number] = step.line
50
55
  example.metadata[:location] = "#{example.metadata[:file_path]}:#{step.line}"
51
56
 
57
+ missing_step_message = "No such step: '#{e}' #{feature_file}:#{step.line}"
52
58
  if ::RSpec.configuration.raise_error_for_unimplemented_steps
53
59
  e.backtrace.push "#{feature_file}:#{step.line}:in `#{step.description}'"
54
- raise
60
+ raise e, missing_step_message
55
61
  end
56
62
 
57
- skip("No such step: '#{e}'")
63
+ skip(missing_step_message)
58
64
  rescue StandardError, ::RSpec::Expectations::ExpectationNotMetError => e
65
+ reporter.publish(:step_failed, { step: step })
66
+
59
67
  e.backtrace.push "#{feature_file}:#{step.line}:in `#{step.description}'"
60
68
  raise e
61
69
  end
70
+
71
+ reporter.publish(:step_passed, { step: step })
62
72
  end
63
73
  end
64
74
 
@@ -91,10 +101,11 @@ module Turnip
91
101
  end
92
102
 
93
103
  group.scenarios.each do |scenario|
94
- step_names = (background_steps + scenario.steps).map(&:to_s)
95
- description = step_names.join(' -> ')
104
+ all_steps = background_steps + scenario.steps
105
+ description = all_steps.map(&:to_s).join(' -> ')
106
+ metadata = scenario.metadata_hash.merge(turnip_steps: all_steps)
96
107
 
97
- context.describe scenario.name, scenario.metadata_hash do
108
+ context.describe scenario.name, metadata do
98
109
  instance_eval <<-EOS, filename, scenario.line
99
110
  it description do
100
111
  scenario.steps.each do |step|
@@ -1,3 +1,3 @@
1
1
  module Turnip
2
- VERSION = '4.3.0'
2
+ VERSION = '4.4.1'
3
3
  end
data/spec/builder_spec.rb CHANGED
@@ -48,6 +48,8 @@ describe Turnip::Builder do
48
48
  expect(feature.tags[0]).to be_instance_of Turnip::Node::Tag
49
49
  expect(feature.scenarios[0].tags[0].name).to eq 'cool'
50
50
  expect(feature.scenarios[1].tag_names).to eq ['stealthy', 'wicked']
51
+ expect(feature.scenarios[2].tag_names).to eq ['variety']
52
+ expect(feature.scenarios[3].tag_names).to eq ['variety']
51
53
  end
52
54
  end
53
55
 
@@ -12,12 +12,13 @@ describe 'The CLI', :type => :integration do
12
12
  end
13
13
 
14
14
  it "prints out failures and successes" do
15
- @result.should include('45 examples, 4 failures, 5 pending')
15
+ @result.should include('48 examples, 4 failures, 7 pending')
16
16
  end
17
17
 
18
18
  it "includes features in backtraces" do
19
19
  @result.should include('examples/errors.feature:5:in `raise error')
20
20
  @result.should include('examples/errors.feature:11:in `a step just does not exist')
21
+ @result.should include("No such step: 'a step just does not exist'")
21
22
  end
22
23
 
23
24
  it "includes the right step name when steps call steps" do
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe Turnip::Node::Feature do
4
+ let(:feature) { Turnip::Builder.build(feature_file) }
5
+
6
+ context 'a file that specifies a language' do
7
+ let(:feature_file) { File.expand_path('../../examples/specific_language.feature', __dir__) }
8
+
9
+ it 'extracts the language' do
10
+ feature.language.should eq 'en-au'
11
+ end
12
+
13
+ end
14
+ end
@@ -0,0 +1,52 @@
1
+ require "spec_helper"
2
+
3
+ describe Turnip::RSpec::Execute do
4
+ let(:mod) { Module.new }
5
+ let(:obj) { Object.new.tap { |o| o.extend Turnip::RSpec::Execute; o.extend mod; def o.skip(*args); end } }
6
+ let(:reporter) { RSpec.current_example.reporter }
7
+
8
+ before { allow(reporter).to receive(:publish).and_call_original }
9
+
10
+ def create_step_node(text)
11
+ Turnip::Node::Step.new OpenStruct.new(source_line: 1, source_column: 0, text: text)
12
+ end
13
+
14
+ context '#run_step' do
15
+ it "publishes :step_started event when step is starting" do
16
+ step = create_step_node "a test step"
17
+
18
+ obj.run_step 'test.feature', step
19
+
20
+ expect(reporter).to have_received(:publish).with(:step_started, step: step)
21
+ end
22
+
23
+ it "publishes :step_passed event when step has passed" do
24
+ mod.step("a test step") { true }
25
+ step = create_step_node "a test step"
26
+
27
+ obj.run_step 'test.feature', step
28
+
29
+ expect(reporter).to have_received(:publish).with(:step_passed, step: step)
30
+ end
31
+
32
+ it "publishes :step_failed event when step has failed" do
33
+ mod.step("a failing step") { raise ::RSpec::Expectations::ExpectationNotMetError }
34
+ step = create_step_node "a failing step"
35
+
36
+ begin
37
+ obj.run_step 'test.feature', step
38
+ rescue ::RSpec::Expectations::ExpectationNotMetError => e
39
+ end
40
+
41
+ expect(reporter).to have_received(:publish).with(:step_failed, step: step)
42
+ end
43
+
44
+ it "publishes :step_pending event when step is pending" do
45
+ step = create_step_node "a pending step"
46
+
47
+ obj.run_step 'test.feature', step
48
+
49
+ expect(reporter).to have_received(:publish).with(:step_pending, step: step)
50
+ end
51
+ end
52
+ end
data/turnip.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_runtime_dependency "rspec", [">=3.0", "<4.0"]
22
- s.add_runtime_dependency "cucumber-gherkin", "~> 14.0"
22
+ s.add_runtime_dependency "cuke_modeler", "~> 3.15"
23
23
  s.add_development_dependency "rake"
24
24
  s.add_development_dependency "pry"
25
25
  s.add_development_dependency "pry-byebug"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turnip
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-16 00:00:00.000000000 Z
11
+ date: 1980-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -31,19 +31,19 @@ dependencies:
31
31
  - !ruby/object:Gem::Version
32
32
  version: '4.0'
33
33
  - !ruby/object:Gem::Dependency
34
- name: cucumber-gherkin
34
+ name: cuke_modeler
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '14.0'
39
+ version: '3.15'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '14.0'
46
+ version: '3.15'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -94,9 +94,11 @@ executables: []
94
94
  extensions: []
95
95
  extra_rdoc_files: []
96
96
  files:
97
+ - ".envrc"
97
98
  - ".github/workflows/test.yml"
98
99
  - ".gitignore"
99
100
  - ".rspec"
101
+ - ".tool-versions"
100
102
  - CHANGELOG.md
101
103
  - Gemfile
102
104
  - README.md
@@ -115,6 +117,7 @@ files:
115
117
  - examples/scenario_outline_scenario_name_substitution.feature
116
118
  - examples/scenario_outline_table_substitution.feature
117
119
  - examples/simple_feature.feature
120
+ - examples/specific_language.feature
118
121
  - examples/step_calling.feature
119
122
  - examples/steps/alignment_steps.rb
120
123
  - examples/steps/autoload_steps.rb
@@ -131,8 +134,10 @@ files:
131
134
  - examples/tags.feature
132
135
  - examples/with_backticks.feature
133
136
  - examples/with_comments.feature
134
- - gemfiles/Gemfile-rspec-3.10.x
135
- - gemfiles/Gemfile-rspec-3.9.x
137
+ - flake.lock
138
+ - flake.nix
139
+ - gemfiles/Gemfile-rspec-3.11.x
140
+ - gemfiles/Gemfile-rspec-3.12.x
136
141
  - lib/turnip.rb
137
142
  - lib/turnip/builder.rb
138
143
  - lib/turnip/capybara.rb
@@ -160,7 +165,9 @@ files:
160
165
  - spec/define_and_execute_spec.rb
161
166
  - spec/dsl_spec.rb
162
167
  - spec/integration_spec.rb
168
+ - spec/nodes/feature_spec.rb
163
169
  - spec/placeholder_spec.rb
170
+ - spec/reporter_spec.rb
164
171
  - spec/spec_helper.rb
165
172
  - spec/step_definition_spec.rb
166
173
  - spec/table_spec.rb
@@ -169,7 +176,7 @@ homepage: https://github.com/jnicklas/turnip/
169
176
  licenses:
170
177
  - MIT
171
178
  metadata: {}
172
- post_install_message:
179
+ post_install_message:
173
180
  rdoc_options: []
174
181
  require_paths:
175
182
  - lib
@@ -184,8 +191,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
191
  - !ruby/object:Gem::Version
185
192
  version: '0'
186
193
  requirements: []
187
- rubygems_version: 3.0.3
188
- signing_key:
194
+ rubygems_version: 3.4.19
195
+ signing_key:
189
196
  specification_version: 4
190
197
  summary: Gherkin extension for RSpec
191
198
  test_files:
@@ -193,7 +200,9 @@ test_files:
193
200
  - spec/define_and_execute_spec.rb
194
201
  - spec/dsl_spec.rb
195
202
  - spec/integration_spec.rb
203
+ - spec/nodes/feature_spec.rb
196
204
  - spec/placeholder_spec.rb
205
+ - spec/reporter_spec.rb
197
206
  - spec/spec_helper.rb
198
207
  - spec/step_definition_spec.rb
199
208
  - spec/table_spec.rb