turnip 3.1.0 → 4.3.0

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: db04bddfd94b8b6e3e3c5a43fb62f45cb8322873b06ff8a0dd8636efb249b524
4
- data.tar.gz: 3aaa0f8839286df02a563fa2b7903e79747dedf29d27f93f7d737dceda0dfed3
3
+ metadata.gz: 8a5b2f61d3782f307c76f247b14f6a814c9b23e756ed5a1ebdb2d5f1261454af
4
+ data.tar.gz: d4d5876e9b484995c2883448e4b302d68ec14094e52dde6d78c5b99232d801a1
5
5
  SHA512:
6
- metadata.gz: 1e9deb546d2b5747a9ab0667e70baccb0469ac59eaa665ac97876258435d9bcfb512e74956ee3567237e8363238251d1a567749547f3e2b991a9d021bedfd733
7
- data.tar.gz: c824cf5ae72f02fd6150e38ec53f9c551a1a2a20768359b1e20efae22948fecce49e07dd6afb0131dbd212b50fbfb2ffbef6082a3e64b9602f41a661b91cced2
6
+ metadata.gz: 8b433ce756fb3c6430c1544e9b94acf5a36ad5de1607ad71824961be0fa313907f2d05f1cb55102d424935a8f311cd99045c0d6bec039edb997f51418fab6b9d
7
+ data.tar.gz: c30109444ccc7b315b98db85a4f24bbd31082289d35a4a6930d8c657adcc278e6bd8d1420082d6061a8f61fe10cae461a8d6e56a6ea0347eb9917d9e110ab1ce
@@ -0,0 +1,23 @@
1
+ name: Test
2
+ on: [push, pull_request]
3
+ jobs:
4
+ test:
5
+ strategy:
6
+ fail-fast: false
7
+ matrix:
8
+ ruby:
9
+ - '2.5'
10
+ - '2.6'
11
+ - '2.7'
12
+ - jruby
13
+ gemfiles:
14
+ - gemfiles/Gemfile-rspec-3.9.x
15
+ - gemfiles/Gemfile-rspec-3.10.x
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v2
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{ matrix.ruby }}
22
+ - run: bundle install --gemfile ${{ matrix.gemfiles }} --jobs 4 --retry 3
23
+ - run: bundle exec --gemfile ${{ matrix.gemfiles }} rake
data/CHANGELOG.md ADDED
@@ -0,0 +1,90 @@
1
+ # CHANGE LOG
2
+
3
+ ## [Unreleased]
4
+
5
+ ## [4.3.0] - 2021-05-16
6
+
7
+ ### Added
8
+
9
+ - Support scenario name substitution [[GH-237](https://github.com/jnicklas/turnip/pull/237)]
10
+
11
+ ### Fixed
12
+
13
+ - Support RSpec 3.9 and 3.10 (drop 3.7 and 3.8) [[GH-238](https://github.com/jnicklas/turnip/pull/238)]
14
+ - Replace TravisCI with GitHub Workflows [[GH-239](https://github.com/jnicklas/turnip/pull/239)]
15
+
16
+ ## [4.2.0] - 2020-09-02
17
+
18
+ ### Changed
19
+
20
+ - Update gherkin version
21
+ - v11 [[GH-222](https://github.com/jnicklas/turnip/pull/222)]
22
+ - v12 [[GH-224](https://github.com/jnicklas/turnip/pull/224)]
23
+ - v14 [[GH-229](https://github.com/jnicklas/turnip/pull/229)]
24
+
25
+ ### Fixed
26
+
27
+ - Test against Ruby 2.7 [[GH-223](https://github.com/jnicklas/turnip/pull/223)]
28
+ - Drop support Ruby 2.3 and 2.4 [[GH-225](https://github.com/jnicklas/turnip/pull/225)]
29
+ - Update travis.yml [[GH-226](https://github.com/jnicklas/turnip/pull/226)]]
30
+ - Setup GitHub Actions [[GH-227](https://github.com/jnicklas/turnip/pull/227)]
31
+ - Suppress deprecation warning in Capybara 3.33.0 [[GH-232](https://github.com/jnicklas/turnip/pull/232)]
32
+
33
+ ## [4.1.0] - 2020-03-02
34
+
35
+ ### Added
36
+
37
+ - Warn when replacing placeholders [[GH-219](https://github.com/jnicklas/turnip/pull/219))
38
+
39
+ ### Changed
40
+
41
+ - Update gherkin version
42
+ - v8 [[GH-217](https://github.com/jnicklas/turnip/pull/217)]
43
+ - v9 [[GH-218](https://github.com/jnicklas/turnip/pull/218)]
44
+ - v10 [[GH-221](https://github.com/jnicklas/turnip/pull/221)]
45
+
46
+ ### Fixed
47
+
48
+ - Update README.md [[GH-216](https://github.com/jnicklas/turnip/pull/216)]
49
+
50
+ ## [4.0.1] - 2019-04-22
51
+
52
+ ### Changed
53
+
54
+ - Add `required_ruby_version` [[GH-212](https://github.com/jnicklas/turnip/pull/212)]
55
+ - Add support Ruby 2.6 by upgrading Gherkin version [[GH-214](https://github.com/jnicklas/turnip/pull/214)]
56
+
57
+ ### Fixed
58
+
59
+ - Update README.md [[GH-211](https://github.com/jnicklas/turnip/pull/211)]
60
+ - Add homepage url to gemspec [[GH-209](https://github.com/jnicklas/turnip/pull/209)]
61
+
62
+ ## [4.0.0] - 2019-02-28
63
+
64
+ ### Changed
65
+
66
+ - Use Gherkin 6.0 [[GH-206](https://github.com/jnicklas/turnip/pull/206)] [[GH-208](https://github.com/jnicklas/turnip/pull/208)]
67
+ - Support RSpec 3.7 and 3.8 (drop 3.6) [[GH-203](https://github.com/jnicklas/turnip/pull/203)]
68
+ - Drop support Ruby 2.2 [[GH-204](https://github.com/jnicklas/turnip/pull/204)]
69
+
70
+ ### Fixed
71
+
72
+ - Test against Ruby 2.6 (fail yet) [[GH-207](https://github.com/jnicklas/turnip/pull/207)]
73
+
74
+ ## [3.1.0] - 2018-01-30
75
+
76
+ ### Changed
77
+
78
+ - Use Gherkin 5.0 [[GH-200](https://github.com/jnicklas/turnip/pull/200)]
79
+ - Support Ruby 2.5.0 [[GH-201](https://github.com/jnicklas/turnip/pull/201)]
80
+ - Drop support Ruby 2.1 [[GH-191](https://github.com/jnicklas/turnip/pull/191)]
81
+ - Support RSpec 3.7.0 and 3.6.0 [[GH-197](https://github.com/jnicklas/turnip/pull/197)]
82
+
83
+ ## Fixed
84
+
85
+ - Add license to gemspec [[GH-193](https://github.com/jnicklas/turnip/pull/193)]
86
+ - Suppress warning [[GH-195](https://github.com/jnicklas/turnip/pull/195)]
87
+
88
+ ## [3.0.0] - 2017-04-04
89
+
90
+ TBD (You can see https://github.com/jnicklas/turnip/releases for before this bersion)
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in turnip.gemspec
4
3
  gemspec
4
+
5
+ gem "pry-byebug", platforms: :mri
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![Join the chat at https://gitter.im/jnicklas/turnip](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jnicklas/turnip?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
 
5
- [![Build Status](https://secure.travis-ci.org/jnicklas/turnip.png)](http://travis-ci.org/jnicklas/turnip)
5
+ ![Test](https://github.com/jnicklas/turnip/workflows/Test/badge.svg)
6
6
  [![Code Climate](https://codeclimate.com/github/jnicklas/turnip.png)](https://codeclimate.com/github/jnicklas/turnip)
7
7
 
8
8
  Turnip is a [Gherkin](https://github.com/cucumber/cucumber/wiki/Gherkin)
@@ -48,8 +48,8 @@ Please create a topic branch for every separate change you make.
48
48
 
49
49
  ### 1. Ruby
50
50
 
51
- - Support Ruby 2.2 or higher
52
- - Does not support Ruby (or does not work) 2.1.X or earlier
51
+ - Support Ruby 2.5 or higher
52
+ - Does not support Ruby (or does not work) 2.4.X or earlier
53
53
 
54
54
  ### 2. RSpec
55
55
 
@@ -425,6 +425,17 @@ step "there are the following monsters:" do |table|
425
425
  end
426
426
  ```
427
427
 
428
+ or the equivalent:
429
+
430
+ ``` ruby
431
+ step "there are the following monsters:" do |table|
432
+ @monsters = {}
433
+ table.rows.each do |(name, hp)|
434
+ @monsters[name] = hp.to_i
435
+ end
436
+ end
437
+ ```
438
+
428
439
  ## Unimplemented steps
429
440
  Turnip mark a scenario as pending when steps in the scenario is not implemented.
430
441
  If you sets `raise_error_for_unimplemented_steps` as `true`, turnip will mark a scenario as fail.
@@ -0,0 +1,25 @@
1
+ Feature: Gherkin 6 syntax
2
+
3
+ Background:
4
+ Given there is a monster with 2 hitpoints
5
+
6
+ Scenario: Battle
7
+ When I attack it
8
+ Then the monster should be alive
9
+ When I attack it
10
+ Then it should die
11
+
12
+ Rule: Battle with preemptive attack
13
+ Background:
14
+ Given I attack the monster and do 1 points damage
15
+
16
+ Example: battle
17
+ When I attack it
18
+ Then it should die
19
+
20
+ Rule: Battle with preemptive critical attack
21
+ Background:
22
+ Given I attack the monster and do 2 points damage
23
+
24
+ Example: battle
25
+ Then it should die
@@ -0,0 +1,13 @@
1
+ Feature: using scenario outlines
2
+ Scenario Outline: a monster introduced himself as <name>
3
+ Given there is a monster called <name>
4
+ Then the monster introduced himself:
5
+ """
6
+ Ahhhhhhh! i'm <name>!
7
+ """
8
+
9
+ Examples:
10
+ | name |
11
+ | John |
12
+ | "John Smith" |
13
+ | "O'Flannahan" |
@@ -3,4 +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.7.0'
6
+ gem 'rspec', '~> 3.10.0'
7
+ gem 'pry-byebug', platforms: :mri
@@ -3,4 +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.6.0'
6
+ gem 'rspec', '~> 3.9.0'
7
+ gem 'pry-byebug', platforms: :mri
@@ -1,13 +1,18 @@
1
- require "gherkin/parser"
1
+ require "gherkin"
2
2
  require 'turnip/node/feature'
3
3
 
4
4
  module Turnip
5
5
  class Builder
6
6
  def self.build(feature_file)
7
- parser = Gherkin::Parser.new
8
- result = parser.parse(File.read(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
9
14
 
10
- return nil unless result[:feature]
15
+ return nil if result.nil? || result[:feature].nil?
11
16
  Node::Feature.new(result[:feature])
12
17
  end
13
18
  end
@@ -7,7 +7,8 @@ RSpec.configure do |config|
7
7
  if self.class.include?(Capybara::DSL) and current_example.metadata[:turnip]
8
8
  Capybara.current_driver = Capybara.javascript_driver if current_example.metadata.has_key?(:javascript)
9
9
  current_example.metadata.each do |tag, value|
10
- if Capybara.drivers.has_key?(tag)
10
+ has_driver = Capybara::VERSION >= '3.33.0' ? !Capybara.drivers[tag].nil? : Capybara.drivers.has_key?(tag)
11
+ if has_driver
11
12
  Capybara.current_driver = tag
12
13
  end
13
14
  end
@@ -42,7 +42,7 @@ module Turnip
42
42
  # @return [Array]
43
43
  #
44
44
  def header
45
- @header ||= @raw[:tableHeader][:cells].map { |c| c[:value] }
45
+ @header ||= @raw[:table_header][:cells].map { |c| c[:value] }
46
46
  end
47
47
 
48
48
  #
@@ -56,7 +56,7 @@ module Turnip
56
56
  # @return [Array]
57
57
  #
58
58
  def rows
59
- @rows ||= @raw[:tableBody].map do |row|
59
+ @rows ||= @raw[:table_body].map do |row|
60
60
  row[:cells].map { |c| c[:value] }
61
61
  end
62
62
  end
@@ -1,8 +1,7 @@
1
1
  require 'turnip/node/base'
2
2
  require 'turnip/node/tag'
3
- require 'turnip/node/scenario'
4
- require 'turnip/node/scenario_outline'
5
- require 'turnip/node/background'
3
+ require 'turnip/node/scenario_group_definition'
4
+ require 'turnip/node/rule'
6
5
 
7
6
  module Turnip
8
7
  module Node
@@ -20,55 +19,36 @@ module Turnip
20
19
  # children: [], # Array of Background, Scenario and Scenario Outline
21
20
  # }
22
21
  #
23
- class Feature < Base
22
+ class Feature < ScenarioGroupDefinition
24
23
  include HasTags
25
24
 
26
- def name
27
- @raw[:name]
28
- end
29
-
30
25
  def language
31
26
  @raw[:language]
32
27
  end
33
28
 
34
- def keyword
35
- @raw[:keyword]
36
- end
29
+ def children
30
+ @children ||= @raw[:children].map do |child|
31
+ unless child[:background].nil?
32
+ next Background.new(child[:background])
33
+ end
37
34
 
38
- def description
39
- @raw[:description]
40
- end
35
+ unless child[:scenario].nil?
36
+ klass = child.dig(:scenario, :examples).nil? ? Scenario : ScenarioOutline
37
+ next klass.new(child[:scenario])
38
+ end
41
39
 
42
- def children
43
- @children ||= @raw[:children].map do |c|
44
- case c[:type]
45
- when :Background
46
- Background.new(c)
47
- when :Scenario
48
- Scenario.new(c)
49
- when :ScenarioOutline
50
- ScenarioOutline.new(c)
40
+ unless child[:rule].nil?
41
+ next Rule.new(child[:rule])
51
42
  end
52
43
  end.compact
53
44
  end
54
45
 
55
- def backgrounds
56
- @backgrounds ||= children.select do |c|
57
- c.is_a?(Background)
46
+ def rules
47
+ @rules ||= children.select do |c|
48
+ c.is_a?(Rule)
58
49
  end
59
50
  end
60
51
 
61
- def scenarios
62
- @scenarios ||= children.map do |c|
63
- case c
64
- when Scenario
65
- c
66
- when ScenarioOutline
67
- c.to_scenarios
68
- end
69
- end.flatten.compact
70
- end
71
-
72
52
  def metadata_hash
73
53
  super.merge(:type => Turnip.type, :turnip => true)
74
54
  end
@@ -0,0 +1,32 @@
1
+ require 'turnip/node/scenario_group_definition'
2
+
3
+ module Turnip
4
+ module Node
5
+ #
6
+ # @note Rule metadata generated by Gherkin
7
+ #
8
+ # {
9
+ # type: :Rule,
10
+ # location: { line: 10, column: 3 },
11
+ # keyword: 'Rule',
12
+ # name: 'Rule name',
13
+ # description: 'Rule description',
14
+ # children: [] # Array of Background, Scenario and Scenario Outline
15
+ # }
16
+ #
17
+ class Rule < ScenarioGroupDefinition
18
+ def children
19
+ @children ||= @raw[:children].map do |child|
20
+ unless child[:background].nil?
21
+ next Background.new(child[:background])
22
+ end
23
+
24
+ unless child[:scenario].nil?
25
+ klass = child.dig(:scenario, :examples).nil? ? Scenario : ScenarioOutline
26
+ next klass.new(child[:scenario])
27
+ end
28
+ end.compact
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,39 @@
1
+ require 'turnip/node/base'
2
+ require 'turnip/node/scenario'
3
+ require 'turnip/node/scenario_outline'
4
+ require 'turnip/node/background'
5
+
6
+ module Turnip
7
+ module Node
8
+ class ScenarioGroupDefinition < Base
9
+ def name
10
+ @raw[:name]
11
+ end
12
+
13
+ def keyword
14
+ @raw[:keyword]
15
+ end
16
+
17
+ def description
18
+ @raw[:description]
19
+ end
20
+
21
+ def backgrounds
22
+ @backgrounds ||= children.select do |c|
23
+ c.is_a?(Background)
24
+ end
25
+ end
26
+
27
+ def scenarios
28
+ @scenarios ||= children.map do |c|
29
+ case c
30
+ when Scenario
31
+ c
32
+ when ScenarioOutline
33
+ c.to_scenarios
34
+ end
35
+ end.flatten.compact
36
+ end
37
+ end
38
+ end
39
+ end
@@ -57,7 +57,7 @@ module Turnip
57
57
  header = example.header
58
58
 
59
59
  example.rows.map do |row|
60
- metadata = convert_metadata_to_scenario
60
+ metadata = convert_metadata_to_scenario(header, row)
61
61
 
62
62
  #
63
63
  # Replace <placeholder> using Example values
@@ -65,13 +65,11 @@ module Turnip
65
65
  metadata[:steps].each do |step|
66
66
  step[:text] = substitute(step[:text], header, row)
67
67
 
68
- next if step[:argument].nil?
69
-
70
- case step[:argument][:type]
71
- when :DocString
72
- step[:argument][:content] = substitute(step[:argument][:content], header, row)
73
- when :DataTable
74
- step[:argument][:rows].map do |table_row|
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|
75
73
  table_row[:cells].map do |cell|
76
74
  cell[:value] = substitute(cell[:value], header, row)
77
75
  end
@@ -117,10 +115,11 @@ module Turnip
117
115
  # @todo :keyword is not considered a language (en only)
118
116
  # @return [Hash]
119
117
  #
120
- def convert_metadata_to_scenario()
118
+ def convert_metadata_to_scenario(header, row)
121
119
  # deep copy
122
120
  Marshal.load(Marshal.dump(raw)).tap do |new_raw|
123
121
  new_raw.delete(:examples)
122
+ new_raw[:name] = substitute(new_raw[:name], header, row)
124
123
  new_raw[:type] = :Scenario
125
124
  new_raw[:keyword] = 'Scenario'
126
125
  end
@@ -31,13 +31,11 @@ module Turnip
31
31
  end
32
32
 
33
33
  def argument
34
- return nil if @raw[:argument].nil?
35
-
36
- @argument ||= case @raw[:argument][:type]
37
- when :DocString
38
- doc_string(@raw[:argument])
39
- when :DataTable
40
- data_table(@raw[:argument])
34
+ @argument ||= case
35
+ when @raw[:doc_string]
36
+ doc_string(@raw[:doc_string])
37
+ when @raw[:data_table]
38
+ data_table(@raw[:data_table])
41
39
  end
42
40
  end
43
41
 
@@ -22,7 +22,7 @@ module Turnip
22
22
  # @return [Array] Array of Tag
23
23
  #
24
24
  def tags
25
- @tags ||= @raw[:tags].map do |tag|
25
+ @tags ||= @raw.fetch(:tags, []).map do |tag|
26
26
  Tag.new(tag)
27
27
  end
28
28
  end
@@ -4,6 +4,11 @@ module Turnip
4
4
 
5
5
  class << self
6
6
  def add(name, &block)
7
+ if placeholders.key?(name)
8
+ location = caller_locations.detect { |l| l.to_s !~ /lib\/turnip\/dsl\.rb/ }
9
+ warn "Placeholder :#{name} was replaced at #{location}."
10
+ end
11
+
7
12
  placeholders[name] = Placeholder.new(name, &block)
8
13
  end
9
14
 
data/lib/turnip/rspec.rb CHANGED
@@ -70,14 +70,19 @@ module Turnip
70
70
 
71
71
  instance_eval <<-EOS, feature_file, feature.line
72
72
  context = ::RSpec.describe feature.name, feature.metadata_hash
73
- run_feature(context, feature, feature_file)
73
+ run_scenario_group(context, feature, feature_file)
74
74
  EOS
75
75
  end
76
76
 
77
77
  private
78
78
 
79
- def run_feature(context, feature, filename)
80
- background_steps = feature.backgrounds.map(&:steps).flatten
79
+ #
80
+ # @param [RSpec::ExampleGroups] context
81
+ # @param [Turnip::Node::Feature|Turnip::Node::Rule] group
82
+ # @param [String] filename
83
+ #
84
+ def run_scenario_group(context, group, filename)
85
+ background_steps = group.backgrounds.map(&:steps).flatten
81
86
 
82
87
  context.before do
83
88
  background_steps.each do |step|
@@ -85,7 +90,7 @@ module Turnip
85
90
  end
86
91
  end
87
92
 
88
- feature.scenarios.each do |scenario|
93
+ group.scenarios.each do |scenario|
89
94
  step_names = (background_steps + scenario.steps).map(&:to_s)
90
95
  description = step_names.join(' -> ')
91
96
 
@@ -99,6 +104,13 @@ module Turnip
99
104
  EOS
100
105
  end
101
106
  end
107
+
108
+ if group.is_a?(Turnip::Node::Feature)
109
+ group.rules.each do |rule|
110
+ rule_context = context.context(rule.name, { turnip: true })
111
+ run_scenario_group(rule_context, rule, filename)
112
+ end
113
+ end
102
114
  end
103
115
  end
104
116
  end
@@ -1,3 +1,3 @@
1
1
  module Turnip
2
- VERSION = '3.1.0'
2
+ VERSION = '4.3.0'
3
3
  end
data/spec/builder_spec.rb CHANGED
@@ -75,6 +75,18 @@ describe Turnip::Builder do
75
75
  end
76
76
  end
77
77
 
78
+ context "with example scenario name in scenario outlines" do
79
+ let(:feature_file) { File.expand_path('../examples/scenario_outline_scenario_name_substitution.feature', File.dirname(__FILE__)) }
80
+
81
+ it "replaces placeholders in scenario name" do
82
+ feature.scenarios.map(&:name).should eq([
83
+ "a monster introduced himself as John",
84
+ 'a monster introduced himself as "John Smith"',
85
+ %(a monster introduced himself as "O'Flannahan")
86
+ ])
87
+ end
88
+ end
89
+
78
90
  context "with example tables in scenario outlines" do
79
91
  let(:feature_file) { File.expand_path('../examples/scenario_outline_table_substitution.feature', File.dirname(__FILE__)) }
80
92
 
@@ -12,7 +12,7 @@ describe 'The CLI', :type => :integration do
12
12
  end
13
13
 
14
14
  it "prints out failures and successes" do
15
- @result.should include('39 examples, 4 failures, 5 pending')
15
+ @result.should include('45 examples, 4 failures, 5 pending')
16
16
  end
17
17
 
18
18
  it "includes features in backtraces" do
@@ -9,6 +9,8 @@ describe Turnip::Placeholder do
9
9
  end
10
10
  end
11
11
 
12
+ after { Turnip::Placeholder.send(:placeholders).clear }
13
+
12
14
  it 'returns a regexp for the given placeholder' do
13
15
  resolved = described_class.resolve(:test)
14
16
 
@@ -150,4 +152,19 @@ describe Turnip::Placeholder do
150
152
  end
151
153
  end
152
154
  end
155
+
156
+ describe 'replacing placeholders' do
157
+ before do
158
+ described_class.add(:test) do
159
+ match(/foo/)
160
+ end
161
+ end
162
+
163
+ it 'issues a warning' do
164
+ expect(described_class).to receive(:warn).with(/Placeholder :test was replaced/)
165
+ described_class.add(:test) do
166
+ match(/bar/)
167
+ end
168
+ end
169
+ end
153
170
  end
@@ -3,6 +3,8 @@ require "spec_helper"
3
3
  describe Turnip::StepDefinition do
4
4
  let(:all_steps) { [] }
5
5
 
6
+ after { Turnip::Placeholder.send(:placeholders).clear }
7
+
6
8
  describe "#match" do
7
9
  it "matches a simple step" do
8
10
  step = Turnip::StepDefinition.new("there are monsters") {}
data/turnip.gemspec CHANGED
@@ -3,24 +3,24 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
  require "turnip/version"
4
4
 
5
5
  Gem::Specification.new do |s|
6
+ s.required_ruby_version = ">= 2.3"
6
7
  s.name = "turnip"
7
8
  s.version = Turnip::VERSION
8
9
  s.authors = ["Jonas Nicklas"]
9
10
  s.email = ["jonas.nicklas@gmail.com"]
10
- s.homepage = ""
11
+ s.homepage = "https://github.com/jnicklas/turnip/"
11
12
  s.license = "MIT"
12
13
  s.summary = %q{Gherkin extension for RSpec}
13
14
  s.description = %q{Provides the ability to define steps and run Gherkin files from with RSpec}
14
15
 
15
- s.rubyforge_project = "turnip"
16
-
17
16
  s.files = `git ls-files`.split("\n")
18
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
19
  s.require_paths = ["lib"]
21
20
 
22
21
  s.add_runtime_dependency "rspec", [">=3.0", "<4.0"]
23
- s.add_runtime_dependency "gherkin", "~> 5.0"
22
+ s.add_runtime_dependency "cucumber-gherkin", "~> 14.0"
24
23
  s.add_development_dependency "rake"
25
24
  s.add_development_dependency "pry"
25
+ s.add_development_dependency "pry-byebug"
26
26
  end
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: 3.1.0
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-01 00:00:00.000000000 Z
11
+ date: 2021-05-16 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: gherkin
34
+ name: cucumber-gherkin
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '5.0'
39
+ version: '14.0'
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: '5.0'
46
+ version: '14.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -72,6 +72,20 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: pry-byebug
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
75
89
  description: Provides the ability to define steps and run Gherkin files from with
76
90
  RSpec
77
91
  email:
@@ -80,9 +94,10 @@ executables: []
80
94
  extensions: []
81
95
  extra_rdoc_files: []
82
96
  files:
97
+ - ".github/workflows/test.yml"
83
98
  - ".gitignore"
84
99
  - ".rspec"
85
- - ".travis.yml"
100
+ - CHANGELOG.md
86
101
  - Gemfile
87
102
  - README.md
88
103
  - Rakefile
@@ -91,11 +106,13 @@ files:
91
106
  - examples/backgrounds.feature
92
107
  - examples/blank.feature
93
108
  - examples/errors.feature
109
+ - examples/gherkin6_syntax.feature
94
110
  - examples/interpolation.feature
95
111
  - examples/multiline_string.feature
96
112
  - examples/pending.feature
97
113
  - examples/scenario_outline.feature
98
114
  - examples/scenario_outline_multiline_string_substitution.feature
115
+ - examples/scenario_outline_scenario_name_substitution.feature
99
116
  - examples/scenario_outline_table_substitution.feature
100
117
  - examples/simple_feature.feature
101
118
  - examples/step_calling.feature
@@ -114,8 +131,8 @@ files:
114
131
  - examples/tags.feature
115
132
  - examples/with_backticks.feature
116
133
  - examples/with_comments.feature
117
- - gemfiles/Gemfile-rspec-3.6.x
118
- - gemfiles/Gemfile-rspec-3.7.x
134
+ - gemfiles/Gemfile-rspec-3.10.x
135
+ - gemfiles/Gemfile-rspec-3.9.x
119
136
  - lib/turnip.rb
120
137
  - lib/turnip/builder.rb
121
138
  - lib/turnip/capybara.rb
@@ -127,8 +144,10 @@ files:
127
144
  - lib/turnip/node/example.rb
128
145
  - lib/turnip/node/feature.rb
129
146
  - lib/turnip/node/location.rb
147
+ - lib/turnip/node/rule.rb
130
148
  - lib/turnip/node/scenario.rb
131
149
  - lib/turnip/node/scenario_definition.rb
150
+ - lib/turnip/node/scenario_group_definition.rb
132
151
  - lib/turnip/node/scenario_outline.rb
133
152
  - lib/turnip/node/step.rb
134
153
  - lib/turnip/node/tag.rb
@@ -146,7 +165,7 @@ files:
146
165
  - spec/step_definition_spec.rb
147
166
  - spec/table_spec.rb
148
167
  - turnip.gemspec
149
- homepage: ''
168
+ homepage: https://github.com/jnicklas/turnip/
150
169
  licenses:
151
170
  - MIT
152
171
  metadata: {}
@@ -158,15 +177,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
158
177
  requirements:
159
178
  - - ">="
160
179
  - !ruby/object:Gem::Version
161
- version: '0'
180
+ version: '2.3'
162
181
  required_rubygems_version: !ruby/object:Gem::Requirement
163
182
  requirements:
164
183
  - - ">="
165
184
  - !ruby/object:Gem::Version
166
185
  version: '0'
167
186
  requirements: []
168
- rubyforge_project: turnip
169
- rubygems_version: 2.7.3
187
+ rubygems_version: 3.0.3
170
188
  signing_key:
171
189
  specification_version: 4
172
190
  summary: Gherkin extension for RSpec
data/.travis.yml DELETED
@@ -1,19 +0,0 @@
1
- language: ruby
2
-
3
- sudo: false
4
- cache: bundler
5
-
6
- branches:
7
- only:
8
- - master
9
-
10
- rvm:
11
- - 2.2
12
- - 2.3.6
13
- - 2.4.3
14
- - 2.5.0
15
- - jruby-19mode
16
-
17
- gemfile:
18
- - gemfiles/Gemfile-rspec-3.6.x
19
- - gemfiles/Gemfile-rspec-3.7.x