rutabaga 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +36 -0
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.github/workflows/gempush.yml +32 -0
- data/.github/workflows/project-board.yml +17 -0
- data/.github/workflows/rubocop-analysis.yml +22 -0
- data/CHANGELOG.md +5 -0
- data/CODEOWNERS +4 -0
- data/Gemfile +4 -7
- data/README.md +5 -27
- data/Rakefile +3 -1
- data/catalog-info.yaml +8 -0
- data/examples/compatibility/compatibility_spec.rb +5 -3
- data/examples/pattern/test_pattern_spec.rb +4 -2
- data/examples/spec_helper.rb +3 -1
- data/examples/test_feature_example_group_spec.rb +31 -31
- data/examples/test_spec.rb +6 -5
- data/lib/rspec/core/example_group_patch.rb +12 -7
- data/lib/rutabaga/example_group/feature.rb +3 -1
- data/lib/rutabaga/no_turnip.rb +4 -2
- data/lib/rutabaga/turnip.rb +7 -5
- data/lib/rutabaga/util.rb +11 -7
- data/lib/rutabaga/version.rb +3 -1
- data/lib/rutabaga.rb +2 -0
- data/rutabaga.gemspec +7 -6
- data/spec/feature_spec.rb +18 -16
- data/spec/formatter_spec.rb +8 -6
- data/spec/no_turnip_spec.rb +27 -25
- data/spec/rspec_formatter/formatter.rb +4 -2
- data/spec/rutabaga/util_spec.rb +66 -54
- data/spec/spec_helper.rb +3 -1
- metadata +27 -28
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6a38a9e6277b182b50fc33ded4f92eaec8b3d9b8888112af72e08f287e38e84
|
4
|
+
data.tar.gz: f9cbe896db240cb89be5454991ab06d0d9abf4072046bda5630ea794e018b9be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e0aca4cd5ff1afdd6a0e7f800d424dd0a1bb1edd546e849134a8021ed0df47a5cfeb87af8b5243a32eddc4c6da157b01228ec92cc8b43ace0b9ba27ab174ea0
|
7
|
+
data.tar.gz: 5123b99de3be3fc63399b06e71f9baad2065e45bf1bca864cedd8fec50f27c69a8c7c6e879fdd0612bcdf899fdc1a3fb25ff7a69560e1e7c1cabf3609f6991e7
|
@@ -0,0 +1,36 @@
|
|
1
|
+
name: Development
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
types: [opened, reopened]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
test:
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
os: [ubuntu-latest, macos-latest]
|
14
|
+
ruby: [2.5, 2.6, 2.7, jruby]
|
15
|
+
gemfile: [Gemfile, Gemfile.turnip3]
|
16
|
+
runs-on: ${{ matrix.os }}
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
|
20
|
+
- uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
ruby-version: ${{matrix.ruby}}
|
23
|
+
|
24
|
+
- uses: actions/cache@v1
|
25
|
+
with:
|
26
|
+
path: vendor/bundle
|
27
|
+
key: bundle-use-ruby-${{matrix.os}}-${{matrix.ruby}}-${{hashFiles('**/${{matrix.gemfile}}')}}
|
28
|
+
restore-keys: |
|
29
|
+
bundle-use-ruby-${{matrix.os}}-${{matrix.ruby}}-${{hashFiles('**/${{matrix.gemfile}}')}}
|
30
|
+
|
31
|
+
- name: Bundle install...
|
32
|
+
run: |
|
33
|
+
bundle config path vendor/bundle
|
34
|
+
bundle install --gemfile=${{matrix.gemfile}}
|
35
|
+
|
36
|
+
- run: bundle exec rspec spec
|
@@ -0,0 +1,70 @@
|
|
1
|
+
# For most projects, this workflow file will not need changing; you simply need
|
2
|
+
# to commit it to your repository.
|
3
|
+
#
|
4
|
+
# You may wish to alter this file to override the set of languages analyzed,
|
5
|
+
# or to provide custom queries or build logic.
|
6
|
+
#
|
7
|
+
# ******** NOTE ********
|
8
|
+
# We have attempted to detect the languages in your repository. Please check
|
9
|
+
# the `language` matrix defined below to confirm you have the correct set of
|
10
|
+
# supported CodeQL languages.
|
11
|
+
#
|
12
|
+
name: "CodeQL"
|
13
|
+
|
14
|
+
on:
|
15
|
+
push:
|
16
|
+
branches: [ master ]
|
17
|
+
pull_request:
|
18
|
+
# The branches below must be a subset of the branches above
|
19
|
+
branches: [ master ]
|
20
|
+
schedule:
|
21
|
+
- cron: '24 10 * * 6'
|
22
|
+
|
23
|
+
jobs:
|
24
|
+
analyze:
|
25
|
+
name: Analyze
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
permissions:
|
28
|
+
actions: read
|
29
|
+
contents: read
|
30
|
+
security-events: write
|
31
|
+
|
32
|
+
strategy:
|
33
|
+
fail-fast: false
|
34
|
+
matrix:
|
35
|
+
language: [ 'ruby' ]
|
36
|
+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
37
|
+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
38
|
+
|
39
|
+
steps:
|
40
|
+
- name: Checkout repository
|
41
|
+
uses: actions/checkout@v2
|
42
|
+
|
43
|
+
# Initializes the CodeQL tools for scanning.
|
44
|
+
- name: Initialize CodeQL
|
45
|
+
uses: github/codeql-action/init@v1
|
46
|
+
with:
|
47
|
+
languages: ${{ matrix.language }}
|
48
|
+
# If you wish to specify custom queries, you can do so here or in a config file.
|
49
|
+
# By default, queries listed here will override any specified in a config file.
|
50
|
+
# Prefix the list here with "+" to use these queries and those in the config file.
|
51
|
+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
52
|
+
|
53
|
+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
54
|
+
# If this step fails, then you should remove it and run the build manually (see below)
|
55
|
+
- name: Autobuild
|
56
|
+
uses: github/codeql-action/autobuild@v1
|
57
|
+
|
58
|
+
# ℹ️ Command-line programs to run using the OS shell.
|
59
|
+
# 📚 https://git.io/JvXDl
|
60
|
+
|
61
|
+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
62
|
+
# and modify them (or add more) to build your code if your project
|
63
|
+
# uses a compiled language
|
64
|
+
|
65
|
+
#- run: |
|
66
|
+
# make bootstrap
|
67
|
+
# make release
|
68
|
+
|
69
|
+
- name: Perform CodeQL Analysis
|
70
|
+
uses: github/codeql-action/analyze@v1
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Ruby Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ master ]
|
6
|
+
paths:
|
7
|
+
- 'lib/rutabaga/version.rb'
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
name: Build + Publish
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby 2.6
|
17
|
+
uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
version: 2.6.x
|
20
|
+
|
21
|
+
- name: Publish to RubyGems
|
22
|
+
run: |
|
23
|
+
gem install gem-release
|
24
|
+
mkdir -p $HOME/.gem
|
25
|
+
touch $HOME/.gem/credentials
|
26
|
+
chmod 0600 $HOME/.gem/credentials
|
27
|
+
git config --global user.email ${{ github.event.pusher.email }}
|
28
|
+
git config --global user.name ${{ github.event.pusher.name }}
|
29
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
30
|
+
gem release --tag --push
|
31
|
+
env:
|
32
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
name: Automatically add new Issues to Silversmith's GitHub project board
|
2
|
+
# https://github.com/orgs/simplybusiness/projects/3
|
3
|
+
# New issues in this repository will be added to the board.
|
4
|
+
on:
|
5
|
+
issues:
|
6
|
+
types: [ opened, reopened ]
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
track_issues:
|
10
|
+
uses: simplybusiness/github-action-reusable-workflows/.github/workflows/project-board.yaml@master
|
11
|
+
with:
|
12
|
+
pr-id: ${{ github.event.issue.node_id }}
|
13
|
+
project-number: 3
|
14
|
+
org: simplybusiness
|
15
|
+
actor: ${{ github.actor }}
|
16
|
+
secrets:
|
17
|
+
github-token: ${{ secrets.SILVERSMITHS_PROJECT_MANAGEMENT }}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: "Rubocop"
|
2
|
+
|
3
|
+
on: [push]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
rubocop_job:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
name: Code Scanning job run
|
9
|
+
strategy:
|
10
|
+
fail-fast: false
|
11
|
+
|
12
|
+
steps:
|
13
|
+
- name: Checkout repository
|
14
|
+
uses: actions/checkout@v2
|
15
|
+
|
16
|
+
- name: Rubocop run
|
17
|
+
uses: arthurnn/code-scanning-rubocop/rubocop-action@master
|
18
|
+
|
19
|
+
- name: Upload Sarif output
|
20
|
+
uses: github/codeql-action/upload-sarif@v1
|
21
|
+
with:
|
22
|
+
sarif_file: rubocop.sarif
|
data/CHANGELOG.md
CHANGED
data/CODEOWNERS
ADDED
data/Gemfile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
5
|
# Specify your gem's dependencies in rutabaga.gemspec
|
@@ -6,13 +8,8 @@ gemspec
|
|
6
8
|
platform :ruby do
|
7
9
|
gem 'pry-byebug'
|
8
10
|
gem 'pry-doc'
|
9
|
-
gem 'pry-stack_explorer'
|
10
11
|
gem 'pry-rescue'
|
12
|
+
gem 'pry-stack_explorer'
|
11
13
|
end
|
12
14
|
|
13
|
-
|
14
|
-
if RUBY_VERSION.to_f < 2.2
|
15
|
-
gem 'rack', '~> 1.6'
|
16
|
-
else
|
17
|
-
gem 'rack'
|
18
|
-
end
|
15
|
+
gem 'rack'
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Rutabaga allows you to invert the control of feature files, so that features are
|
|
8
8
|
|
9
9
|
This means that it is simple to create tests that are described by a class (such as controller tests in rspec-rails).
|
10
10
|
|
11
|
-
[![Build Status](https://
|
11
|
+
[![Build Status](https://github.com/simplybusiness/rutabaga/workflows/.github/workflows/ci.yml/badge.svg)](https://github.com/simplybusiness/rutabaga/actions?query=workflow%3ADevelopment)
|
12
12
|
[![Gem Version](https://badge.fury.io/rb/rutabaga.svg)](https://badge.fury.io/rb/rutabaga)
|
13
13
|
|
14
14
|
## Installation
|
@@ -171,31 +171,9 @@ The goal is to test just the business rule in Rutabaga, and not the login, the h
|
|
171
171
|
|
172
172
|
## For maintainers
|
173
173
|
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
```
|
179
|
-
gem bump --tag --release --push
|
180
|
-
```
|
181
|
-
|
182
|
-
if instead you want to bump the minor version (e.g. 0.0.1 to 0.1.0):
|
183
|
-
|
184
|
-
```
|
185
|
-
gem bump --version minor --tag --release --push
|
186
|
-
```
|
187
|
-
|
188
|
-
or major version (e.g. 0.0.1 to 1.0.0):
|
189
|
-
|
190
|
-
```
|
191
|
-
gem bump --version major --tag --release --push
|
192
|
-
```
|
193
|
-
|
194
|
-
If you've updated the version already, after merging to `master` run:
|
195
|
-
|
196
|
-
```
|
197
|
-
gem release --tag --push
|
198
|
-
```
|
174
|
+
To release a new version of the gem, bump the version in `lib/rutabaga/version.rb`
|
175
|
+
using Semantic Versioning and merge to master. This will trigger a new version to
|
176
|
+
be deployed.
|
199
177
|
|
200
178
|
## Testing alternate versions
|
201
179
|
|
@@ -210,4 +188,4 @@ gem 'turnip', '3.1.0'
|
|
210
188
|
|
211
189
|
## Copyright
|
212
190
|
|
213
|
-
Copyright © 2012-
|
191
|
+
Copyright © 2012-2020 Simply Business. See LICENSE for details.
|
data/Rakefile
CHANGED
data/catalog-info.yaml
ADDED
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'capybara/rspec'
|
3
5
|
|
4
|
-
describe
|
6
|
+
describe 'capaybara rails does not overwrite the feature command' do
|
5
7
|
feature '../test2.feature' do
|
6
|
-
step
|
8
|
+
step 'that :first + :second is calculated' do |first, second|
|
7
9
|
@first = first
|
8
10
|
@second = second
|
9
11
|
end
|
10
12
|
|
11
|
-
step
|
13
|
+
step 'my result is :result' do |result|
|
12
14
|
expect(@first.to_i + @second.to_i - 1).to eq(result.to_i)
|
13
15
|
end
|
14
16
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
4
|
-
it
|
5
|
+
describe 'it prints out the RSpec.configuration.pattern' do
|
6
|
+
it 'examples/test2.feature' do
|
5
7
|
puts "RSpec.configuration.pattern: #{RSpec.configuration.pattern}"
|
6
8
|
end
|
7
9
|
end
|
data/examples/spec_helper.rb
CHANGED
@@ -1,109 +1,109 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
5
|
+
describe 'test feature argument' do
|
4
6
|
feature
|
5
7
|
|
6
|
-
step
|
8
|
+
step 'that :first + :second is calculated' do |first, second|
|
7
9
|
@first = first
|
8
10
|
@second = second
|
9
11
|
end
|
10
12
|
|
11
|
-
step
|
13
|
+
step 'my result is :result' do |result|
|
12
14
|
expect(@first.to_i + @second.to_i).to eq(result.to_i)
|
13
15
|
end
|
14
16
|
end
|
15
17
|
|
16
|
-
feature
|
17
|
-
step
|
18
|
+
feature 'feature block' do
|
19
|
+
step 'that :first + :second is calculated' do |first, second|
|
18
20
|
@first = first
|
19
21
|
@second = second
|
20
22
|
end
|
21
23
|
|
22
|
-
step
|
24
|
+
step 'my result is :result' do |result|
|
23
25
|
expect(@first.to_i + @second.to_i).to eq(result.to_i)
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
|
-
describe
|
29
|
+
describe 'feature block inside a describe block' do
|
28
30
|
feature do
|
29
|
-
|
30
|
-
step "that :first + :second is calculated" do |first, second|
|
31
|
+
step 'that :first + :second is calculated' do |first, second|
|
31
32
|
@first = first
|
32
33
|
@second = second
|
33
34
|
end
|
34
35
|
|
35
|
-
step
|
36
|
+
step 'my result is :result' do |result|
|
36
37
|
expect(@first.to_i + @second.to_i).to eq(result.to_i)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
41
|
-
describe
|
42
|
-
feature
|
42
|
+
describe 'should find feature file using root (and monkey patch result)' do
|
43
|
+
feature 'examples/test2.feature'
|
43
44
|
|
44
|
-
step
|
45
|
+
step 'that :first + :second is calculated' do |first, second|
|
45
46
|
@first = first
|
46
47
|
@second = second
|
47
48
|
end
|
48
49
|
|
49
|
-
step
|
50
|
+
step 'my result is :result' do |result|
|
50
51
|
expect(@first.to_i + @second.to_i - 1).to eq(result.to_i)
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
54
|
-
describe
|
55
|
-
feature
|
55
|
+
describe 'causes a failing test' do
|
56
|
+
feature 'examples/test2.feature'
|
56
57
|
|
57
|
-
step
|
58
|
+
step 'that :first + :second is calculated' do |first, second|
|
58
59
|
@first = first
|
59
60
|
@second = second
|
60
61
|
end
|
61
62
|
|
62
|
-
step
|
63
|
+
step 'my result is :result' do |result|
|
63
64
|
expect(@first.to_i + @second.to_i).to eq(result.to_i)
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
67
68
|
describe "finds a feature file given as parameter to the 'feature' method" do
|
68
|
-
feature
|
69
|
+
feature 'examples/test3.feature'
|
69
70
|
|
70
|
-
step
|
71
|
+
step 'that :first * :second is calculated' do |first, second|
|
71
72
|
@first = first
|
72
73
|
@second = second
|
73
74
|
end
|
74
75
|
|
75
|
-
step
|
76
|
+
step 'my result is :result' do |result|
|
76
77
|
expect(@first.to_i * @second.to_i).to eq(result.to_i)
|
77
78
|
end
|
78
79
|
end
|
79
80
|
|
80
|
-
describe
|
81
|
-
feature
|
81
|
+
describe 'finds a feature file with a different name in the same directory' do
|
82
|
+
feature 'test3.feature'
|
82
83
|
|
83
|
-
step
|
84
|
+
step 'that :first * :second is calculated' do |first, second|
|
84
85
|
@first = first
|
85
86
|
@second = second
|
86
87
|
end
|
87
88
|
|
88
|
-
step
|
89
|
+
step 'my result is :result' do |result|
|
89
90
|
expect(@first.to_i * @second.to_i).to eq(result.to_i)
|
90
91
|
end
|
91
92
|
end
|
92
93
|
|
93
|
-
describe
|
94
|
-
feature
|
94
|
+
describe 'backgrounds are properly called' do
|
95
|
+
feature 'examples/test_background.feature'
|
95
96
|
|
96
|
-
step
|
97
|
+
step 'we add :initial' do |_initial|
|
97
98
|
@initial = 10
|
98
99
|
end
|
99
100
|
|
100
|
-
step
|
101
|
+
step 'that :first * :second is calculated' do |first, second|
|
101
102
|
@first = first
|
102
103
|
@second = second
|
103
104
|
end
|
104
105
|
|
105
|
-
step
|
106
|
+
step 'my result is :result' do |result|
|
106
107
|
expect(@initial.to_i + @first.to_i * @second.to_i).to eq(result.to_i)
|
107
108
|
end
|
108
|
-
|
109
109
|
end
|
data/examples/test_spec.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
|
-
describe
|
4
|
-
feature
|
5
|
+
describe 'should find feature file using root (and monkey patch result)' do
|
6
|
+
feature 'examples/test2.feature'
|
5
7
|
|
6
|
-
step
|
8
|
+
step 'that :first + :second is calculated' do |first, second|
|
7
9
|
@first = first
|
8
10
|
@second = second
|
9
11
|
end
|
10
12
|
|
11
|
-
step
|
13
|
+
step 'my result is :result' do |result|
|
12
14
|
expect(@first.to_i + @second.to_i - 1).to eq(result.to_i)
|
13
15
|
end
|
14
|
-
|
15
16
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# This file needs to be in this folder structure otherwise rspec
|
2
4
|
# will not filter it out of the caller chain, and therefore report
|
3
5
|
# incorrect file locations for example groups. This especially
|
@@ -5,10 +7,11 @@
|
|
5
7
|
|
6
8
|
# Monkey patch rspec to block capybara from using feature
|
7
9
|
class RSpec::Core::Configuration
|
8
|
-
|
10
|
+
alias orig_alias_example_group_to alias_example_group_to
|
9
11
|
|
10
12
|
def alias_example_group_to(new_name, *args)
|
11
|
-
return if [
|
13
|
+
return if %i[feature xfeature ffeature].include?(new_name)
|
14
|
+
|
12
15
|
orig_alias_example_group_to(new_name, *args)
|
13
16
|
end
|
14
17
|
end
|
@@ -16,16 +19,18 @@ end
|
|
16
19
|
# Monkey patch RSpec to add the feature method in example groups
|
17
20
|
class RSpec::Core::ExampleGroup
|
18
21
|
class << self
|
19
|
-
|
22
|
+
alias orig_subclass subclass
|
20
23
|
|
21
24
|
def subclass(parent, description, *all_args, &example_group_block)
|
22
|
-
rutabaga = all_args.first.any? { |arg| arg.
|
25
|
+
rutabaga = all_args.first.any? { |arg| arg.is_a?(Hash) && arg[:rutabaga] }
|
23
26
|
|
24
|
-
|
25
|
-
|
27
|
+
orig_subclass(parent, description, *all_args, &example_group_block).tap do |describe|
|
28
|
+
if rutabaga
|
29
|
+
Rutabaga::ExampleGroup::Feature.feature(describe, description, all_args.last)
|
30
|
+
end
|
26
31
|
end
|
27
32
|
end
|
28
33
|
end
|
29
34
|
|
30
|
-
define_example_group_method :feature, :
|
35
|
+
define_example_group_method :feature, rutabaga: true
|
31
36
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'turnip/rspec'
|
2
4
|
require 'rspec'
|
3
5
|
|
@@ -5,7 +7,7 @@ module Rutabaga
|
|
5
7
|
module ExampleGroup
|
6
8
|
module Feature
|
7
9
|
class << self
|
8
|
-
def feature(example_group_class, description,
|
10
|
+
def feature(example_group_class, description, _args)
|
9
11
|
Util.require_if_exists 'turnip_helper'
|
10
12
|
|
11
13
|
Turnip::RSpec.rutabaga_run(Util.find_feature(description), example_group_class)
|
data/lib/rutabaga/no_turnip.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Rutabaga
|
2
4
|
NO_TURNIP = true
|
3
5
|
end
|
@@ -12,7 +14,7 @@ module Turnip
|
|
12
14
|
module Loader
|
13
15
|
def load(*a, &b)
|
14
16
|
if a.first.end_with?('.feature')
|
15
|
-
::RSpec.warning
|
17
|
+
::RSpec.warning 'Calling features directly has been disabled by rutabaga. To re-enable, do not require rutabaga/no_turnip.'
|
16
18
|
else
|
17
19
|
super
|
18
20
|
end
|
@@ -23,5 +25,5 @@ end
|
|
23
25
|
|
24
26
|
::RSpec.configure do |c|
|
25
27
|
# Blow away rutabaga's pattern if still there
|
26
|
-
c.pattern.gsub!(
|
28
|
+
c.pattern.gsub!(',features/**/*.feature', '')
|
27
29
|
end
|
data/lib/rutabaga/turnip.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rutabaga'
|
2
4
|
##
|
3
5
|
#
|
@@ -8,8 +10,8 @@ module Turnip
|
|
8
10
|
module Loader
|
9
11
|
def load(*a, &b)
|
10
12
|
if a.first.end_with?('.feature')
|
11
|
-
if legal_directories.none? {|d| a.first.end_with? d }
|
12
|
-
::RSpec.warning
|
13
|
+
if legal_directories.none? { |d| a.first.end_with? d }
|
14
|
+
::RSpec.warning 'Features can only be called from turnip enable directories. These are configured ' \
|
13
15
|
"in RSpec.configuration.pattern which is currently '#{::RSpec.configuration.pattern}'"
|
14
16
|
else
|
15
17
|
require_if_exists 'turnip_helper'
|
@@ -26,9 +28,9 @@ module Turnip
|
|
26
28
|
|
27
29
|
def legal_directories
|
28
30
|
@legal_directories ||= ::RSpec.configuration.pattern.split(',')
|
29
|
-
|
30
|
-
|
31
|
-
|
31
|
+
.select { |p| /\.feature\Z/ =~ p }
|
32
|
+
.map { |d| Dir.glob(File.join(::RSpec.configuration.default_path, d)) }
|
33
|
+
.flatten
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|