rutabaga 3.0.2 → 3.1.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: 3d6c51a32cd3abeb7753144e65c1166230b9e728d2ca2b34908b08b434454810
4
- data.tar.gz: 3e0926f70210244f08f675b1e4fb4684b3553705a8b50e4acdf8812f87173955
3
+ metadata.gz: b6a38a9e6277b182b50fc33ded4f92eaec8b3d9b8888112af72e08f287e38e84
4
+ data.tar.gz: f9cbe896db240cb89be5454991ab06d0d9abf4072046bda5630ea794e018b9be
5
5
  SHA512:
6
- metadata.gz: 3dd9b6d369a01336b575178686f32b92a2b3f99c2597f604427985278a080f650e80421966a7099a2606123ba576ef04feb0c069809e381c77803d001410dab1
7
- data.tar.gz: 53bd5a7dfaef0c4af85e2dfa967c83a68916ab0048c7ec2444b5a0936e636c31bf91072e205cedadce122e77c17146c862e0213a4398ff08cfc67d1e4d7c7662
6
+ metadata.gz: 2e0aca4cd5ff1afdd6a0e7f800d424dd0a1bb1edd546e849134a8021ed0df47a5cfeb87af8b5243a32eddc4c6da157b01228ec92cc8b43ace0b9ba27ab174ea0
7
+ data.tar.gz: 5123b99de3be3fc63399b06e71f9baad2065e45bf1bca864cedd8fec50f27c69a8c7c6e879fdd0612bcdf899fdc1a3fb25ff7a69560e1e7c1cabf3609f6991e7
@@ -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
@@ -24,6 +24,8 @@ jobs:
24
24
  mkdir -p $HOME/.gem
25
25
  touch $HOME/.gem/credentials
26
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 }}
27
29
  printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
30
  gem release --tag --push
29
31
  env:
@@ -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/CODEOWNERS ADDED
@@ -0,0 +1,4 @@
1
+ # Add your project owners info here
2
+ # More information: https://help.github.com/articles/about-codeowners/
3
+ * @simplybusiness/silversmiths
4
+
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
- # Gem a dependency of Capybara, new version of rack 2.0 onwards require ruby 2.2 and above.
14
- if RUBY_VERSION.to_f < 2.2
15
- gem 'rack', '~> 1.6'
16
- else
17
- gem 'rack'
18
- end
15
+ gem 'rack'
data/Rakefile CHANGED
@@ -1,2 +1,4 @@
1
1
  #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/gem_tasks'
data/catalog-info.yaml ADDED
@@ -0,0 +1,8 @@
1
+ apiVersion: backstage.io/v1alpha1
2
+ kind: Component
3
+ metadata:
4
+ name: rutabaga
5
+ description: Turnip extension to enable running turnip features from inside spec files, rather than outside.
6
+ spec:
7
+ type: library
8
+ lifecycle: production
@@ -1,14 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'capybara/rspec'
3
5
 
4
- describe "capaybara rails does not overwrite the feature command" do
6
+ describe 'capaybara rails does not overwrite the feature command' do
5
7
  feature '../test2.feature' do
6
- step "that :first + :second is calculated" do |first, second|
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 "my result is :result" do |result|
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 "it prints out the RSpec.configuration.pattern" do
4
- it "examples/test2.feature" do
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
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.configure do |config|
2
4
  config.expect_with :rspec do |c|
3
- c.syntax = [:should, :expect]
5
+ c.syntax = %i[should expect]
4
6
  end
5
7
  end
@@ -1,109 +1,109 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe "test feature argument" do
5
+ describe 'test feature argument' do
4
6
  feature
5
7
 
6
- step "that :first + :second is calculated" do |first, second|
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 "my result is :result" do |result|
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 "feature block" do
17
- step "that :first + :second is calculated" do |first, second|
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 "my result is :result" do |result|
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 "feature block inside a describe block" do
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 "my result is :result" do |result|
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 "should find the feature file using the root (and monkey patching the result)" do
42
- feature "examples/test2.feature"
42
+ describe 'should find feature file using root (and monkey patch result)' do
43
+ feature 'examples/test2.feature'
43
44
 
44
- step "that :first + :second is calculated" do |first, second|
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 "my result is :result" do |result|
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 "causes a failing test" do
55
- feature "examples/test2.feature"
55
+ describe 'causes a failing test' do
56
+ feature 'examples/test2.feature'
56
57
 
57
- step "that :first + :second is calculated" do |first, second|
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 "my result is :result" do |result|
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 "examples/test3.feature"
69
+ feature 'examples/test3.feature'
69
70
 
70
- step "that :first * :second is calculated" do |first, second|
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 "my result is :result" do |result|
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 "finds a feature file with a different name in the same directory" do
81
- feature "test3.feature"
81
+ describe 'finds a feature file with a different name in the same directory' do
82
+ feature 'test3.feature'
82
83
 
83
- step "that :first * :second is calculated" do |first, second|
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 "my result is :result" do |result|
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 "backgrounds are properly called" do
94
- feature "examples/test_background.feature"
94
+ describe 'backgrounds are properly called' do
95
+ feature 'examples/test_background.feature'
95
96
 
96
- step "we add :initial" do |initial|
97
+ step 'we add :initial' do |_initial|
97
98
  @initial = 10
98
99
  end
99
100
 
100
- step "that :first * :second is calculated" do |first, second|
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 "my result is :result" do |result|
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
@@ -1,15 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe "should find the feature file using the root (and monkey patching the result)" do
4
- feature "examples/test2.feature"
5
+ describe 'should find feature file using root (and monkey patch result)' do
6
+ feature 'examples/test2.feature'
5
7
 
6
- step "that :first + :second is calculated" do |first, second|
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 "my result is :result" do |result|
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
- alias_method :orig_alias_example_group_to, :alias_example_group_to
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 [:feature, :xfeature, :ffeature].include?(new_name)
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
- alias_method :orig_subclass, :subclass
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.kind_of?(Hash) && arg[:rutabaga] }
25
+ rutabaga = all_args.first.any? { |arg| arg.is_a?(Hash) && arg[:rutabaga] }
23
26
 
24
- self.orig_subclass(parent, description, *all_args, &example_group_block).tap do |describe|
25
- Rutabaga::ExampleGroup::Feature.feature(describe, description, all_args.last) if rutabaga
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, :rutabaga => true
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, args)
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)
@@ -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 "Calling features directly has been disabled by rutabaga. To re-enable, do not require rutabaga/no_turnip."
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!(",features/**/*.feature", "")
28
+ c.pattern.gsub!(',features/**/*.feature', '')
27
29
  end
@@ -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 "Features can only be called from turnip enable directories. These are configured " \
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
- .select {|p| /\.feature\Z/ =~ p}
30
- .map {|d| Dir.glob(File.join(::RSpec.configuration.default_path,d)) }
31
- .flatten
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
data/lib/rutabaga/util.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Utils and monkey patches for both versions of feature
2
4
 
3
5
  # Monkey patch for Turnip to not have to copy loads of code
@@ -24,16 +26,18 @@ module Rutabaga
24
26
  tried = []
25
27
 
26
28
  if description =~ /.*\.(feature|rutabaga)\Z/
27
- return description if File.exists?(description)
29
+ return description if File.exist?(description)
30
+
28
31
  tried << description
29
32
 
30
33
  candidate = File.join(extract_directory, description)
31
- return candidate if File.exists?(candidate)
34
+ return candidate if File.exist?(candidate)
35
+
32
36
  tried << candidate
33
37
  else
34
38
  feature_files = extract_features
35
39
  feature_files.each do |feature_file|
36
- return feature_file if File.exists?(feature_file)
40
+ return feature_file if File.exist?(feature_file)
37
41
  end
38
42
  tried += feature_files
39
43
  end
@@ -57,14 +61,14 @@ module Rutabaga
57
61
  def extract_directory
58
62
  caller(0).find do |call|
59
63
  call =~ /_spec.rb:/
60
- end.gsub(/\/[^\/]+_spec.rb:.*\Z/, '')
64
+ end.gsub(%r{/[^/]+_spec.rb:.*\Z}, '')
61
65
  end
62
66
 
63
67
  def extract_features
64
68
  base = caller(0).find do |call|
65
69
  call =~ /_spec.rb:/
66
70
  end.gsub(/_spec.rb:.*\Z/, '')
67
- [base+'.feature', base+'.rutabaga']
71
+ [base + '.feature', base + '.rutabaga']
68
72
  end
69
73
  end
70
74
  end
@@ -73,8 +77,8 @@ end
73
77
  ::RSpec.configure do |c|
74
78
  # Blow away turnip's pattern, and focus just on features directory
75
79
  if defined?(Rutabaga::NO_TURNIP)
76
- c.pattern.gsub!(",**/*.feature", "")
80
+ c.pattern.gsub!(',**/*.feature', '')
77
81
  else
78
- c.pattern.gsub!(",**/*.feature", ",features/**/*.feature")
82
+ c.pattern.gsub!(',**/*.feature', ',features/**/*.feature')
79
83
  end
80
84
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Rutabaga
2
- VERSION = '3.0.2'
4
+ VERSION = '3.1.0'
3
5
  end
data/lib/rutabaga.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rutabaga/version'
2
4
  require 'turnip'
3
5
  require 'rutabaga/example_group/feature'
data/rutabaga.gemspec CHANGED
@@ -1,14 +1,15 @@
1
- # coding: utf-8
2
- require File.expand_path('../lib/rutabaga/version', __FILE__)
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path('lib/rutabaga/version', __dir__)
3
4
 
4
5
  Gem::Specification.new do |gem|
5
6
  gem.authors = ['Lukas Oberhuber']
6
7
  gem.email = ['lukas.oberhuber@simplybusiness.co.uk']
7
- gem.description = %q{Allows using feature from within RSpec and is built on top of Turnip}
8
- gem.summary = %q{Calling Turnip feature files from RSpec, which allows encapsulating a feature inside a describe block}
8
+ gem.description = 'Allows using feature from within RSpec and is built on top of Turnip'
9
+ gem.summary = 'Calling Turnip feature files from RSpec, which allows encapsulating a feature inside a describe block'
9
10
  gem.homepage = 'https://github.com/simplybusiness/rutabaga'
10
11
 
11
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
12
13
  gem.files = `git ls-files`.split("\n")
13
14
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
15
  gem.name = 'rutabaga'
@@ -16,8 +17,8 @@ Gem::Specification.new do |gem|
16
17
  gem.version = Rutabaga::VERSION
17
18
  gem.license = 'MIT'
18
19
 
19
- gem.add_runtime_dependency 'turnip', ['>= 3.1.0', '< 5.0']
20
20
  gem.add_runtime_dependency 'rspec', ['~> 3.0']
21
+ gem.add_runtime_dependency 'turnip', ['>= 3.1.0', '< 4.4']
21
22
 
22
23
  gem.add_development_dependency 'capybara'
23
24
  gem.add_development_dependency 'pry', '~> 0'
data/spec/feature_spec.rb CHANGED
@@ -1,39 +1,41 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe 'integration', :type => :integration do
5
+ describe 'integration', type: :integration do
4
6
  describe 'functionality' do
5
7
  before(:all) do
6
- @result = %x(rspec -r rutabaga -fd examples/*_spec.rb 2>&1)
8
+ @result = `rspec -r rutabaga -fd examples/*_spec.rb 2>&1`
7
9
  end
8
10
 
9
- it "shows the correct description" do
11
+ it 'shows the correct description' do
10
12
  expect(@result).to include('ensures the feature is called')
11
13
  expect(@result).to include('that 2 + 2 is calculated')
12
14
  expect(@result).to include('my result is 4')
13
15
  end
14
16
 
15
- it "executes features as an argument" do
17
+ it 'executes features as an argument' do
16
18
  expect(@result).to include('test feature argument')
17
19
  end
18
20
 
19
- it "executes features as blocks/example groups" do
21
+ it 'executes features as blocks/example groups' do
20
22
  expect(@result).to include('feature block')
21
23
  end
22
24
 
23
- it "executes features as blocks inside example groups" do
25
+ it 'executes features as blocks inside example groups' do
24
26
  expect(@result).to include('feature block inside a describe block')
25
27
  end
26
28
 
27
- it "should not show any pending steps" do
29
+ it 'should not show any pending steps' do
28
30
  expect(@result).not_to include('PENDING')
29
31
  expect(@result).not_to include('No such step')
30
32
  end
31
33
 
32
- it "prints out failures and successes" do
34
+ it 'prints out failures and successes' do
33
35
  expect(@result).to include('18 examples, 4 failures')
34
36
  end
35
37
 
36
- it "should find features relative to the root" do
38
+ it 'should find features relative to the root' do
37
39
  expect(@result).not_to include('Feature file not found')
38
40
  end
39
41
 
@@ -42,26 +44,26 @@ describe 'integration', :type => :integration do
42
44
  expect(@result).to include('my result is 8')
43
45
  end
44
46
 
45
- it "should scope steps to describe blocks" do
47
+ it 'should scope steps to describe blocks' do
46
48
  expect(@result).not_to include('Turnip::Ambiguous')
47
49
  end
48
50
 
49
- it "should provide failure messages that allow a specific scenario to be run" do
50
- expect(@result).to match(/rspec '{0,1}.\/examples\/test_feature_example_group_spec.rb\[1:1:1:4:1\]'{0,1}/)
51
+ it 'should provide failure messages that allow a specific scenario to be run' do
52
+ expect(@result).to match(%r{rspec '{0,1}./examples/test_feature_example_group_spec.rb\[1:1:1:4:1\]'{0,1}})
51
53
  end
52
54
  end
53
55
 
54
56
  describe 'compatibility' do
55
57
  before(:all) do
56
- @result = %x(rspec -r rutabaga -fd examples/compatibility/*_spec.rb 2>&1)
58
+ @result = `rspec -r rutabaga -fd examples/compatibility/*_spec.rb 2>&1`
57
59
  end
58
60
 
59
- it "passes all tests" do
61
+ it 'passes all tests' do
60
62
  expect(@result).to include('1 example, 0 failures')
61
63
  end
62
64
 
63
- it "runs feature blocks even if capybara/rspec is installed" do
64
- expect(@result).to include("capaybara rails does not overwrite the feature command")
65
+ it 'runs feature blocks even if capybara/rspec is installed' do
66
+ expect(@result).to include('capaybara rails does not overwrite the feature command')
65
67
  end
66
68
  end
67
69
  end
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe 'formatter', :type => :integration do
5
+ describe 'formatter', type: :integration do
4
6
  before(:all) do
5
- @result = %x(rspec -r rutabaga -r rspec_formatter/formatter.rb --format RspecFormatter::Formatter spec/features/fixture.feature examples/test_spec.rb 2>&1)
7
+ @result = `rspec -r rutabaga -r rspec_formatter/formatter.rb --format RspecFormatter::Formatter spec/features/fixture.feature examples/test_spec.rb 2>&1`
6
8
  end
7
9
 
8
- it "has the feature location" do
9
- expect(@result).to include("rspec_core_formatter:file_path: ./spec/features/fixture.feature")
10
+ it 'has the feature location' do
11
+ expect(@result).to include('rspec_core_formatter:file_path: ./spec/features/fixture.feature')
10
12
  end
11
13
 
12
- it "has the rutabaga test location" do
13
- expect(@result).to include("rspec_core_formatter:file_path: ./examples/test_spec.rb")
14
+ it 'has the rutabaga test location' do
15
+ expect(@result).to include('rspec_core_formatter:file_path: ./examples/test_spec.rb')
14
16
  end
15
17
  end
@@ -1,57 +1,59 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
- describe 'no_turnip', :type => :integration do
5
+ describe 'no_turnip', type: :integration do
4
6
  describe 'turnip disabled' do
5
7
  before(:all) do
6
- @result = %x(rspec -r rutabaga -r rutabaga/no_turnip examples/test.feature 2>&1)
8
+ @result = `rspec -r rutabaga -r rutabaga/no_turnip examples/test.feature 2>&1`
7
9
  end
8
10
 
9
- it "should raise an error when trying to call turnip features directly" do
10
- expect(@result).to include("Calling features directly has been disabled by rutabaga")
11
- expect(@result).to include("rutabaga/no_turnip")
11
+ it 'should raise an error when trying to call turnip features directly' do
12
+ expect(@result).to include('Calling features directly has been disabled by rutabaga')
13
+ expect(@result).to include('rutabaga/no_turnip')
12
14
  end
13
15
 
14
- it "has the correct file pattern" do
15
- result = %x(rspec -r rutabaga/no_turnip -r rutabaga examples/pattern/test_pattern_spec.rb)
16
+ it 'has the correct file pattern' do
17
+ result = `rspec -r rutabaga/no_turnip -r rutabaga examples/pattern/test_pattern_spec.rb`
16
18
  expect(result).to include("RSpec.configuration.pattern: **{,/*/**}/*_spec.rb\n")
17
- result = %x(rspec -r rutabaga -r rutabaga/no_turnip -r rutabaga examples/pattern/test_pattern_spec.rb)
19
+ result = `rspec -r rutabaga -r rutabaga/no_turnip -r rutabaga examples/pattern/test_pattern_spec.rb`
18
20
  expect(result).to include("RSpec.configuration.pattern: **{,/*/**}/*_spec.rb\n")
19
- result = %x(rspec -r rutabaga/no_turnip examples/pattern/test_pattern_spec.rb)
21
+ result = `rspec -r rutabaga/no_turnip examples/pattern/test_pattern_spec.rb`
20
22
  expect(result).to include("RSpec.configuration.pattern: **{,/*/**}/*_spec.rb\n")
21
23
  end
22
24
  end
23
25
 
24
26
  describe 'turnip enabled' do
25
- describe "in correct directory" do
26
- it "should be able to call features directly" do
27
- @result = %x(rspec -r rutabaga/turnip spec/features/fixture.feature 2>&1)
28
- expect(@result).to include("No such step")
27
+ describe 'in correct directory' do
28
+ it 'should be able to call features directly' do
29
+ @result = `rspec -r rutabaga/turnip spec/features/fixture.feature 2>&1`
30
+ expect(@result).to include('No such step')
29
31
  end
30
32
 
31
- it "rutabaga turnip is the default" do
32
- @result = %x(rspec -r rutabaga spec/features/fixture.feature 2>&1)
33
- expect(@result).to include("No such step")
33
+ it 'rutabaga turnip is the default' do
34
+ @result = `rspec -r rutabaga spec/features/fixture.feature 2>&1`
35
+ expect(@result).to include('No such step')
34
36
  end
35
37
  end
36
38
 
37
- describe "outside of the correct directory" do
39
+ describe 'outside of the correct directory' do
38
40
  before(:all) do
39
- @result = %x(rspec -r rutabaga examples/test.feature 2>&1)
41
+ @result = `rspec -r rutabaga examples/test.feature 2>&1`
40
42
  end
41
43
 
42
- it "warns about the directory" do
43
- expect(@result).to include("WARNING: Features can only be called from turnip enable directories")
44
+ it 'warns about the directory' do
45
+ expect(@result).to include('WARNING: Features can only be called from turnip enable directories')
44
46
  end
45
47
  end
46
48
 
47
- it "has the correct file pattern" do
48
- result = %x(rspec -r rutabaga examples/pattern/test_pattern_spec.rb)
49
+ it 'has the correct file pattern' do
50
+ result = `rspec -r rutabaga examples/pattern/test_pattern_spec.rb`
49
51
  expect(result).to include("RSpec.configuration.pattern: **{,/*/**}/*_spec.rb,features/**/*.feature\n")
50
- result = %x(rspec -r rutabaga/turnip -r rutabaga examples/pattern/test_pattern_spec.rb)
52
+ result = `rspec -r rutabaga/turnip -r rutabaga examples/pattern/test_pattern_spec.rb`
51
53
  expect(result).to include("RSpec.configuration.pattern: **{,/*/**}/*_spec.rb,features/**/*.feature\n")
52
- result = %x(rspec -r rutabaga -r rutabaga/turnip -r rutabaga examples/pattern/test_pattern_spec.rb)
54
+ result = `rspec -r rutabaga -r rutabaga/turnip -r rutabaga examples/pattern/test_pattern_spec.rb`
53
55
  expect(result).to include("RSpec.configuration.pattern: **{,/*/**}/*_spec.rb,features/**/*.feature\n")
54
- result = %x(rspec -r rutabaga/turnip examples/pattern/test_pattern_spec.rb)
56
+ result = `rspec -r rutabaga/turnip examples/pattern/test_pattern_spec.rb`
55
57
  expect(result).to include("RSpec.configuration.pattern: **{,/*/**}/*_spec.rb,features/**/*.feature\n")
56
58
  end
57
59
  end
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RspecFormatter
2
4
  class Formatter
3
5
  RSpec::Core::Formatters.register self, :example_group_started, :example_group_finished
4
6
 
5
- def initialize(output)
7
+ def initialize(_output)
6
8
  @group_nesting = 0
7
9
  end
8
10
 
9
- def example_group_started(example_group)
11
+ def example_group_started(_example_group)
10
12
  @group_nesting += 1
11
13
  end
12
14
 
@@ -1,129 +1,141 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'rutabaga'
3
5
 
4
6
  describe Rutabaga::Util do
5
- describe "location of test from stack track" do
6
- it "finds the directory" do
7
- expect(subject.class.send(:extract_directory)).to match(/\/rutabaga\/spec\/rutabaga\Z/)
7
+ describe 'location of test from stack track' do
8
+ it 'finds the directory' do
9
+ expect(subject.class.send(:extract_directory)).to match(%r{/rutabaga/spec/rutabaga\Z})
8
10
  end
9
11
 
10
- it "finds the feature" do
12
+ it 'finds the feature' do
11
13
  features = subject.class.send(:extract_features)
12
- expect(features[0]).to match(/\/rutabaga\/spec\/rutabaga\/util\.feature\Z/)
13
- expect(features[1]).to match(/\/rutabaga\/spec\/rutabaga\/util\.rutabaga\Z/)
14
+ expect(features[0]).to match(%r{/rutabaga/spec/rutabaga/util\.feature\Z})
15
+ expect(features[1]).to match(%r{/rutabaga/spec/rutabaga/util\.rutabaga\Z})
14
16
  end
15
17
  end
16
18
 
17
- describe ".find_feature" do
19
+ describe '.find_feature' do
18
20
  let(:subject) { Rutabaga::Util.find_feature(@description) }
19
21
  before do
20
- allow(File).to receive(:exists?).with('spec/rutabaga/existing.feature').and_return(true)
21
- allow(File).to receive(:exists?).with('spec/rutabaga/missing.feature').and_return(false)
22
- allow(File).to receive(:exists?).with(nil).and_return(false)
22
+ allow(File).to receive(:exist?).with('spec/rutabaga/existing.feature').and_return(true)
23
+ allow(File).to receive(:exist?).with('spec/rutabaga/missing.feature').and_return(false)
24
+ allow(File).to receive(:exist?).with(nil).and_return(false)
23
25
  end
24
26
 
25
- it "returns the file if it exists" do
27
+ it 'returns the file if it exists' do
26
28
  @description = 'spec/rutabaga/existing.feature'
27
29
  expect(subject).to eq('spec/rutabaga/existing.feature')
28
30
  end
29
31
 
30
32
  describe "looks for the feature in the spec's directory" do
31
33
  before do
32
- allow(File).to receive(:exists?).with('different.feature').and_return(false)
34
+ allow(File).to receive(:exist?).with('different.feature').and_return(false)
33
35
  end
34
36
 
35
- it "looks directly in the directory" do
37
+ it 'looks directly in the directory' do
36
38
  @description = 'different.feature'
37
- expect(File).to receive(:exists?).with(/spec\/rutabaga\/different\.feature\Z/).and_return(true)
39
+ expect(File).to receive(:exist?)
40
+ .with(%r{spec/rutabaga/different\.feature\Z})
41
+ .and_return(true)
38
42
 
39
- expect(subject).to match(/spec\/rutabaga\/different\.feature\Z/)
43
+ expect(subject).to match(%r{spec/rutabaga/different\.feature\Z})
40
44
  end
41
45
 
42
- it "allows sub-directories" do
43
- allow(File).to receive(:exists?).with('subdirectory/different.feature').and_return(false)
46
+ it 'allows sub-directories' do
47
+ allow(File).to receive(:exist?).with('subdirectory/different.feature')
48
+ .and_return(false)
44
49
 
45
50
  @description = 'subdirectory/different.feature'
46
- expect(File).to receive(:exists?).with(/spec\/rutabaga\/subdirectory\/different\.feature\Z/).and_return(true)
51
+ expect(File).to receive(:exist?)
52
+ .with(%r{spec/rutabaga/subdirectory/different\.feature\Z})
53
+ .and_return(true)
47
54
 
48
- expect(subject).to match(/spec\/rutabaga\/subdirectory\/different\.feature\Z/)
55
+ expect(subject).to match(%r{spec/rutabaga/subdirectory/different\.feature\Z})
49
56
  end
50
57
  end
51
58
 
52
- describe "figures out the feature name from the spec name" do
53
- it "description is nil" do
59
+ describe 'figures out the feature name from the spec name' do
60
+ it 'description is nil' do
54
61
  @description = nil
55
- allow(File).to receive(:exists?).with(/spec\/rutabaga\/util\.feature\Z/).and_return(true)
56
- expect(subject).to match(/spec\/rutabaga\/util\.feature\Z/)
62
+ allow(File).to receive(:exist?).with(%r{spec/rutabaga/util\.feature\Z})
63
+ .and_return(true)
64
+ expect(subject).to match(%r{spec/rutabaga/util\.feature\Z})
57
65
  end
58
66
 
59
- it "description does not match a feature file" do
67
+ it 'description does not match a feature file' do
60
68
  @description = 'this is not a feature file'
61
- allow(File).to receive(:exists?).with(/this is not a feature file/).and_return(false)
69
+ allow(File).to receive(:exist?).with(/this is not a feature file/)
70
+ .and_return(false)
62
71
 
63
- allow(File).to receive(:exists?).with(/spec\/rutabaga\/util\.feature\Z/).and_return(true)
64
- expect(subject).to match(/spec\/rutabaga\/util\.feature\Z/)
72
+ allow(File).to receive(:exist?).with(%r{spec/rutabaga/util\.feature\Z})
73
+ .and_return(true)
74
+ expect(subject).to match(%r{spec/rutabaga/util\.feature\Z})
65
75
  end
66
76
 
67
- it "description does not match a feature file" do
77
+ it 'description does not match a feature file' do
68
78
  @description = 'this is not a feature file'
69
- allow(File).to receive(:exists?).with(/this is not a feature file/).and_return(false)
79
+ allow(File).to receive(:exist?).with(/this is not a feature file/).and_return(false)
80
+
81
+ allow(File).to receive(:exist?).with(%r{spec/rutabaga/util\.feature\Z})
82
+ .and_return(false)
83
+ allow(File).to receive(:exist?).with(%r{spec/rutabaga/util\.rutabaga\Z})
84
+ .and_return(true)
70
85
 
71
- allow(File).to receive(:exists?).with(/spec\/rutabaga\/util\.feature\Z/).and_return(false)
72
- allow(File).to receive(:exists?).with(/spec\/rutabaga\/util\.rutabaga\Z/).and_return(true)
73
- expect(subject).to match(/spec\/rutabaga\/util\.rutabaga\Z/)
86
+ expect(subject).to match(%r{spec/rutabaga/util\.rutabaga\Z})
74
87
  end
75
88
 
76
- it "handles paths with spaces" do
89
+ it 'handles paths with spaces' do
77
90
  @description = '/User/person/Internet plugins/feature.feature'
78
- allow(File).to receive(:exists?).with(@description).and_return(true)
91
+ allow(File).to receive(:exist?).with(@description).and_return(true)
79
92
 
80
93
  expect(subject).to eq(@description)
81
94
  end
82
95
 
83
- it "allows the .feature extension" do
84
- @description = "example.feature"
85
- allow(File).to receive(:exists?).with(@description).and_return(true)
96
+ it 'allows the .feature extension' do
97
+ @description = 'example.feature'
98
+ allow(File).to receive(:exist?).with(@description).and_return(true)
86
99
 
87
100
  expect(subject).to include(@description)
88
101
  end
89
102
 
90
- it "allows the .rutabaga extension" do
91
- @description = "example.rutabaga"
92
- allow(File).to receive(:exists?).with(@description).and_return(true)
103
+ it 'allows the .rutabaga extension' do
104
+ @description = 'example.rutabaga'
105
+ allow(File).to receive(:exist?).with(@description).and_return(true)
93
106
 
94
107
  expect(subject).to include(@description)
95
108
  end
96
-
97
109
  end
98
110
 
99
- describe "raises an error if the feature cannot be found" do
111
+ describe 'raises an error if the feature cannot be found' do
100
112
  before do
101
- allow(File).to receive(:exists?).and_return(false)
113
+ allow(File).to receive(:exist?).and_return(false)
102
114
  end
103
115
 
104
- it "has a nil description" do
116
+ it 'has a nil description' do
105
117
  @description = nil
106
118
 
107
- expect{subject}.to raise_error(/Feature file not found\. Tried: .*\/spec\/rutabaga\/util\.feature/)
119
+ expect { subject }.to raise_error(%r{Feature file not found\. Tried: .*/spec/rutabaga/util\.feature})
108
120
  end
109
121
 
110
- it "has a sentance description" do
111
- @description = "my life as a dog"
122
+ it 'has a sentance description' do
123
+ @description = 'my life as a dog'
112
124
 
113
- expect{subject}.to raise_error(/Feature file not found\. Tried: .*\/spec\/rutabaga\/util\.feature/)
125
+ expect { subject }.to raise_error(%r{Feature file not found\. Tried: .*/spec/rutabaga/util\.feature})
114
126
  end
115
127
 
116
128
  it "has a filename description but the file doesn't exist" do
117
- @description = "example.feature"
129
+ @description = 'example.feature'
118
130
 
119
- expect{subject}.to raise_error(/Feature file not found\. Tried: example\.feature, .*example\.feature/)
131
+ expect { subject }.to raise_error(/Feature file not found\. Tried: example\.feature, .*example\.feature/)
120
132
  end
121
133
 
122
- it "raises an error if the filename does not end in feature" do
123
- @description = "example.other"
124
- allow(File).to receive(:exists?).with(@description).and_return(true)
134
+ it 'raises an error if the filename does not end in feature' do
135
+ @description = 'example.other'
136
+ allow(File).to receive(:exist?).with(@description).and_return(true)
125
137
 
126
- expect{subject}.to raise_error(/Feature file not found\. Tried: .*\/spec\/rutabaga\/util\.feature/)
138
+ expect { subject }.to raise_error(%r{Feature file not found\. Tried: .*/spec/rutabaga/util\.feature})
127
139
  end
128
140
  end
129
141
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.configure do |config|
2
4
  config.expect_with :rspec do |c|
3
- c.syntax = [:should, :expect]
5
+ c.syntax = %i[should expect]
4
6
  end
5
7
  end
metadata CHANGED
@@ -1,49 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rutabaga
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Oberhuber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-08 00:00:00.000000000 Z
11
+ date: 2022-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: turnip
14
+ name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 3.1.0
20
- - - "<"
17
+ - - "~>"
21
18
  - !ruby/object:Gem::Version
22
- version: '5.0'
19
+ version: '3.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 3.1.0
30
- - - "<"
24
+ - - "~>"
31
25
  - !ruby/object:Gem::Version
32
- version: '5.0'
26
+ version: '3.0'
33
27
  - !ruby/object:Gem::Dependency
34
- name: rspec
28
+ name: turnip
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
31
+ - - ">="
38
32
  - !ruby/object:Gem::Version
39
- version: '3.0'
33
+ version: 3.1.0
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '4.4'
40
37
  type: :runtime
41
38
  prerelease: false
42
39
  version_requirements: !ruby/object:Gem::Requirement
43
40
  requirements:
44
- - - "~>"
41
+ - - ">="
45
42
  - !ruby/object:Gem::Version
46
- version: '3.0'
43
+ version: 3.1.0
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '4.4'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: capybara
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -80,14 +80,19 @@ extensions: []
80
80
  extra_rdoc_files: []
81
81
  files:
82
82
  - ".github/workflows/ci.yml"
83
+ - ".github/workflows/codeql-analysis.yml"
83
84
  - ".github/workflows/gempush.yml"
85
+ - ".github/workflows/project-board.yml"
86
+ - ".github/workflows/rubocop-analysis.yml"
84
87
  - ".gitignore"
85
88
  - CHANGELOG.md
89
+ - CODEOWNERS
86
90
  - Gemfile
87
91
  - Gemfile.turnip3
88
92
  - LICENSE
89
93
  - README.md
90
94
  - Rakefile
95
+ - catalog-info.yaml
91
96
  - examples/compatibility/compatibility_spec.rb
92
97
  - examples/pattern/test_pattern_spec.rb
93
98
  - examples/spec_helper.rb
@@ -133,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
138
  - !ruby/object:Gem::Version
134
139
  version: '0'
135
140
  requirements: []
136
- rubygems_version: 3.0.3
141
+ rubygems_version: 3.3.7
137
142
  signing_key:
138
143
  specification_version: 4
139
144
  summary: Calling Turnip feature files from RSpec, which allows encapsulating a feature