turnip 3.0.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +24 -0
- data/.travis.yml +7 -15
- data/Gemfile +2 -1
- data/README.md +17 -9
- data/examples/gherkin6_syntax.feature +25 -0
- data/examples/steps/backtick_steps.rb +1 -1
- data/examples/steps/steps.rb +2 -2
- data/gemfiles/{Gemfile-rspec-3.2.x → Gemfile-rspec-3.7.x} +2 -1
- data/gemfiles/{Gemfile-rspec-3.3.x → Gemfile-rspec-3.8.x} +2 -1
- data/gemfiles/{Gemfile-rspec-3.4.x → Gemfile-rspec-3.9.x} +2 -1
- data/lib/turnip/builder.rb +9 -4
- data/lib/turnip/capybara.rb +2 -1
- data/lib/turnip/node/example.rb +2 -2
- data/lib/turnip/node/feature.rb +17 -37
- data/lib/turnip/node/rule.rb +32 -0
- data/lib/turnip/node/scenario_group_definition.rb +39 -0
- data/lib/turnip/node/scenario_outline.rb +5 -7
- data/lib/turnip/node/step.rb +5 -7
- data/lib/turnip/node/tag.rb +1 -1
- data/lib/turnip/placeholder.rb +5 -0
- data/lib/turnip/rspec.rb +16 -4
- data/lib/turnip/version.rb +1 -1
- data/spec/dsl_spec.rb +1 -1
- data/spec/integration_spec.rb +1 -1
- data/spec/placeholder_spec.rb +17 -0
- data/spec/step_definition_spec.rb +4 -3
- data/turnip.gemspec +5 -4
- metadata +31 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c86f0ce3b7829fd47b7383b07a322c1726f84c91b5da26882e7595ff9113c6d2
|
4
|
+
data.tar.gz: 35fd833aac33e1eab40239bdfac960f63c762ac6c5fcdc990cfc8a4669f927cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dff32468733fbdc9998ece81cea23877098f51e24f2a06d32da65ac3fb7afe4beb22f2f45bce45ee3e1e5961193b3bb859cccee8fb72266de83dfddfe187441
|
7
|
+
data.tar.gz: 7a3123de579bf41c9a8aeee4ef04cb9f25814c90e051b77a15319cff29f935634256f4d845668ac8ea83b6782ed0251d2354563023c9a58035a1f6a5730610b6
|
@@ -0,0 +1,24 @@
|
|
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.7.x
|
15
|
+
- gemfiles/Gemfile-rspec-3.8.x
|
16
|
+
- gemfiles/Gemfile-rspec-3.9.x
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
steps:
|
19
|
+
- uses: actions/checkout@v2
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- run: bundle install --gemfile ${{ matrix.gemfiles }} --jobs 4 --retry 3
|
24
|
+
- run: bundle exec --gemfile ${{ matrix.gemfiles }} rake
|
data/.travis.yml
CHANGED
@@ -7,21 +7,13 @@ branches:
|
|
7
7
|
only:
|
8
8
|
- master
|
9
9
|
|
10
|
-
matrix:
|
11
|
-
allow_failures:
|
12
|
-
- gemfile: Gemfile
|
13
|
-
- gemfile: gemfiles/Gemfile-rspec-3.2.x
|
14
|
-
- rvm: ruby-head
|
15
|
-
|
16
10
|
rvm:
|
17
|
-
- 2.
|
18
|
-
- 2.
|
19
|
-
- 2.
|
20
|
-
-
|
21
|
-
- jruby-19mode
|
11
|
+
- 2.5.8
|
12
|
+
- 2.6.6
|
13
|
+
- 2.7.1
|
14
|
+
- jruby
|
22
15
|
|
23
16
|
gemfile:
|
24
|
-
- Gemfile
|
25
|
-
- gemfiles/Gemfile-rspec-3.
|
26
|
-
- gemfiles/Gemfile-rspec-3.
|
27
|
-
- gemfiles/Gemfile-rspec-3.4.x
|
17
|
+
- gemfiles/Gemfile-rspec-3.7.x
|
18
|
+
- gemfiles/Gemfile-rspec-3.8.x
|
19
|
+
- gemfiles/Gemfile-rspec-3.9.x
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
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
5
|
[![Build Status](https://secure.travis-ci.org/jnicklas/turnip.png)](http://travis-ci.org/jnicklas/turnip)
|
6
|
+
![Test](https://github.com/jnicklas/turnip/workflows/Test/badge.svg)
|
6
7
|
[![Code Climate](https://codeclimate.com/github/jnicklas/turnip.png)](https://codeclimate.com/github/jnicklas/turnip)
|
7
8
|
|
8
9
|
Turnip is a [Gherkin](https://github.com/cucumber/cucumber/wiki/Gherkin)
|
@@ -48,9 +49,8 @@ Please create a topic branch for every separate change you make.
|
|
48
49
|
|
49
50
|
### 1. Ruby
|
50
51
|
|
51
|
-
- Support Ruby 2.
|
52
|
-
- Does not support Ruby
|
53
|
-
- Does not work on Ruby 1.8.X
|
52
|
+
- Support Ruby 2.5 or higher
|
53
|
+
- Does not support Ruby (or does not work) 2.4.X or earlier
|
54
54
|
|
55
55
|
### 2. RSpec
|
56
56
|
|
@@ -60,14 +60,11 @@ In accordance with the RSpec support policy https://github.com/jnicklas/turnip/i
|
|
60
60
|
- Does not support **two version before the latest or earlier**
|
61
61
|
- Does not work on **RSpec 2 or earlier**
|
62
62
|
|
63
|
-
Example `If the latest version is 3.
|
63
|
+
Example `If the latest version is 3.5.x`:
|
64
64
|
|
65
|
+
- Support `3.5.x`
|
65
66
|
- Support `3.4.x`
|
66
|
-
-
|
67
|
-
- Does not support `3.2.x`
|
68
|
-
- Does not support `3.1.x`
|
69
|
-
- Does not support `2.x.y`
|
70
|
-
|
67
|
+
- Does not support (or does not work) `3.3.x` or earlier
|
71
68
|
|
72
69
|
## Usage
|
73
70
|
|
@@ -429,6 +426,17 @@ step "there are the following monsters:" do |table|
|
|
429
426
|
end
|
430
427
|
```
|
431
428
|
|
429
|
+
or the equivalent:
|
430
|
+
|
431
|
+
``` ruby
|
432
|
+
step "there are the following monsters:" do |table|
|
433
|
+
@monsters = {}
|
434
|
+
table.rows.each do |(name, hp)|
|
435
|
+
@monsters[name] = hp.to_i
|
436
|
+
end
|
437
|
+
end
|
438
|
+
```
|
439
|
+
|
432
440
|
## Unimplemented steps
|
433
441
|
Turnip mark a scenario as pending when steps in the scenario is not implemented.
|
434
442
|
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
|
data/examples/steps/steps.rb
CHANGED
@@ -108,13 +108,13 @@ step "raise error" do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
placeholder :count do
|
111
|
-
match /\d+/ do |count|
|
111
|
+
match (/\d+/) do |count|
|
112
112
|
count.to_i
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
116
|
placeholder :color do
|
117
|
-
match /blue|green|red/ do |color|
|
117
|
+
match (/blue|green|red/) do |color|
|
118
118
|
color.to_sym
|
119
119
|
end
|
120
120
|
end
|
data/lib/turnip/builder.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
-
require "gherkin
|
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
|
-
|
8
|
-
|
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
|
15
|
+
return nil if result.nil? || result[:feature].nil?
|
11
16
|
Node::Feature.new(result[:feature])
|
12
17
|
end
|
13
18
|
end
|
data/lib/turnip/capybara.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/turnip/node/example.rb
CHANGED
@@ -42,7 +42,7 @@ module Turnip
|
|
42
42
|
# @return [Array]
|
43
43
|
#
|
44
44
|
def header
|
45
|
-
@header ||= @raw[:
|
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[:
|
59
|
+
@rows ||= @raw[:table_body].map do |row|
|
60
60
|
row[:cells].map { |c| c[:value] }
|
61
61
|
end
|
62
62
|
end
|
data/lib/turnip/node/feature.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
require 'turnip/node/base'
|
2
2
|
require 'turnip/node/tag'
|
3
|
-
require 'turnip/node/
|
4
|
-
require 'turnip/node/
|
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 <
|
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
|
35
|
-
@raw[:
|
36
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
43
|
-
|
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
|
56
|
-
@
|
57
|
-
c.is_a?(
|
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
|
@@ -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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
when :
|
72
|
-
step[:
|
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
|
data/lib/turnip/node/step.rb
CHANGED
@@ -31,13 +31,11 @@ module Turnip
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def argument
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
when :
|
38
|
-
|
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
|
|
data/lib/turnip/node/tag.rb
CHANGED
data/lib/turnip/placeholder.rb
CHANGED
@@ -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
|
-
|
73
|
+
run_scenario_group(context, feature, feature_file)
|
74
74
|
EOS
|
75
75
|
end
|
76
76
|
|
77
77
|
private
|
78
78
|
|
79
|
-
|
80
|
-
|
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
|
-
|
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
|
data/lib/turnip/version.rb
CHANGED
data/spec/dsl_spec.rb
CHANGED
data/spec/integration_spec.rb
CHANGED
@@ -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('
|
15
|
+
@result.should include('42 examples, 4 failures, 5 pending')
|
16
16
|
end
|
17
17
|
|
18
18
|
it "includes features in backtraces" do
|
data/spec/placeholder_spec.rb
CHANGED
@@ -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") {}
|
@@ -45,8 +47,7 @@ describe Turnip::StepDefinition do
|
|
45
47
|
Turnip::Placeholder.stub(:resolve).with(:count).and_return(/\d+/)
|
46
48
|
Turnip::Placeholder.should_receive(:find).with(:count).twice.and_return(placeholder)
|
47
49
|
step = Turnip::StepDefinition.new(":count monsters and :count knights") {}
|
48
|
-
|
49
|
-
#match.params.should eq([3, 2])
|
50
|
+
step.match("3 monsters and 2 knights")
|
50
51
|
end
|
51
52
|
|
52
53
|
it "does apply the same custom placeholder several times" do
|
@@ -54,7 +55,7 @@ describe Turnip::StepDefinition do
|
|
54
55
|
Turnip::Placeholder.stub(:resolve).with(:count).and_return(/\d+/)
|
55
56
|
placeholder.should_receive(:apply).twice
|
56
57
|
step = Turnip::StepDefinition.new(":count monsters and :count knights") {}
|
57
|
-
|
58
|
+
step.match("3 monsters and 2 knights")
|
58
59
|
end
|
59
60
|
|
60
61
|
it "matches quoted placeholders" do
|
data/turnip.gemspec
CHANGED
@@ -3,23 +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/"
|
12
|
+
s.license = "MIT"
|
11
13
|
s.summary = %q{Gherkin extension for RSpec}
|
12
14
|
s.description = %q{Provides the ability to define steps and run Gherkin files from with RSpec}
|
13
15
|
|
14
|
-
s.rubyforge_project = "turnip"
|
15
|
-
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = ["lib"]
|
20
20
|
|
21
21
|
s.add_runtime_dependency "rspec", [">=3.0", "<4.0"]
|
22
|
-
s.add_runtime_dependency "gherkin", "~>
|
22
|
+
s.add_runtime_dependency "cucumber-gherkin", "~> 14.0"
|
23
23
|
s.add_development_dependency "rake"
|
24
24
|
s.add_development_dependency "pry"
|
25
|
+
s.add_development_dependency "pry-byebug"
|
25
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:
|
4
|
+
version: 4.2.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:
|
11
|
+
date: 2020-09-02 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: '
|
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: '
|
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,6 +94,7 @@ executables: []
|
|
80
94
|
extensions: []
|
81
95
|
extra_rdoc_files: []
|
82
96
|
files:
|
97
|
+
- ".github/workflows/test.yml"
|
83
98
|
- ".gitignore"
|
84
99
|
- ".rspec"
|
85
100
|
- ".travis.yml"
|
@@ -91,6 +106,7 @@ 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
|
@@ -114,9 +130,9 @@ files:
|
|
114
130
|
- examples/tags.feature
|
115
131
|
- examples/with_backticks.feature
|
116
132
|
- examples/with_comments.feature
|
117
|
-
- gemfiles/Gemfile-rspec-3.
|
118
|
-
- gemfiles/Gemfile-rspec-3.
|
119
|
-
- gemfiles/Gemfile-rspec-3.
|
133
|
+
- gemfiles/Gemfile-rspec-3.7.x
|
134
|
+
- gemfiles/Gemfile-rspec-3.8.x
|
135
|
+
- gemfiles/Gemfile-rspec-3.9.x
|
120
136
|
- lib/turnip.rb
|
121
137
|
- lib/turnip/builder.rb
|
122
138
|
- lib/turnip/capybara.rb
|
@@ -128,8 +144,10 @@ files:
|
|
128
144
|
- lib/turnip/node/example.rb
|
129
145
|
- lib/turnip/node/feature.rb
|
130
146
|
- lib/turnip/node/location.rb
|
147
|
+
- lib/turnip/node/rule.rb
|
131
148
|
- lib/turnip/node/scenario.rb
|
132
149
|
- lib/turnip/node/scenario_definition.rb
|
150
|
+
- lib/turnip/node/scenario_group_definition.rb
|
133
151
|
- lib/turnip/node/scenario_outline.rb
|
134
152
|
- lib/turnip/node/step.rb
|
135
153
|
- lib/turnip/node/tag.rb
|
@@ -147,8 +165,9 @@ files:
|
|
147
165
|
- spec/step_definition_spec.rb
|
148
166
|
- spec/table_spec.rb
|
149
167
|
- turnip.gemspec
|
150
|
-
homepage:
|
151
|
-
licenses:
|
168
|
+
homepage: https://github.com/jnicklas/turnip/
|
169
|
+
licenses:
|
170
|
+
- MIT
|
152
171
|
metadata: {}
|
153
172
|
post_install_message:
|
154
173
|
rdoc_options: []
|
@@ -158,15 +177,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
177
|
requirements:
|
159
178
|
- - ">="
|
160
179
|
- !ruby/object:Gem::Version
|
161
|
-
version: '
|
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
|
-
|
169
|
-
rubygems_version: 2.5.1
|
187
|
+
rubygems_version: 3.0.3
|
170
188
|
signing_key:
|
171
189
|
specification_version: 4
|
172
190
|
summary: Gherkin extension for RSpec
|