Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

Commit bf49c78

Browse files
petergoldsteinJonRowe
authored andcommittedApr 1, 2022
Loosen the cucumber version restriction and handle varying tag syntax
This change looses the cucumber version restriction, allowing recent cucumbers. It also handles the change in the 'not' syntax for tags, allowing it to run on a wide range of Ruby versions Don't use Fixnum in the described_class test. Add an 'outer' test.
1 parent c9f899a commit bf49c78

11 files changed

+38
-14
lines changed
 

‎Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ if RUBY_VERSION < '2.4.0'
9494
gem 'minitest', '< 5.12.0'
9595
end
9696

97+
if RUBY_VERSION < '2.0.0'
98+
gem 'cucumber', "<= 1.3.22"
99+
end
100+
97101
gem 'contracts', '< 0.16' if RUBY_VERSION < '1.9.0'
98102

99103
eval File.read('Gemfile-custom') if File.exist?('Gemfile-custom')

‎cucumber.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<%
2+
3+
USE_TILDE_TAGS = !defined?(::RUBY_ENGINE_VERSION) || (::RUBY_ENGINE_VERSION < '2.0.0')
4+
NOT_WIP_TAG = USE_TILDE_TAGS ? '~@wip' : '"not @wip"'
5+
NOT_JRUBY_TAG = USE_TILDE_TAGS ? '~@no-jruby' : '"not @no-jruby"'
6+
27
exclusions = []
3-
exclusions << ' --tags ~@no-jruby' if RUBY_PLATFORM == 'java'
8+
exclusions << " --tags #{NOT_JRUBY_TAG}" if RUBY_PLATFORM == 'java'
49
%>
5-
default: --require features --strict --format progress --tags ~@wip<%= exclusions.join %> features
10+
default: --require features --strict --format progress --tags <%= NOT_WIP_TAG %><%= exclusions.join %> features
611
wip: --require features --tags @wip:30 --wip features

‎features/command_line/init.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Feature: `--init` option
2525
Scenario: Accept and use the recommended settings in `spec_helper` (which are initially commented out)
2626
Given I have a brand new project with no files
2727
And I have run `rspec --init`
28-
When I accept the recommended settings by removing `=begin` and `=end` from `spec/spec_helper.rb`
28+
When I accept the recommended settings by removing `=begin` and `=end` from `spec_helper.rb`
2929
And I create "spec/addition_spec.rb" with the following content:
3030
"""ruby
3131
RSpec.describe "Addition" do

‎features/metadata/described_class.feature

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ Feature: described class
66
Scenario: Access the described class from the example
77
Given a file named "spec/example_spec.rb" with:
88
"""ruby
9-
RSpec.describe Fixnum do
9+
RSpec.describe Symbol do
10+
it "is available as described_class" do
11+
expect(described_class).to eq(Symbol)
12+
end
13+
1014
describe 'inner' do
1115
describe String do
1216
it "is available as described_class" do

‎features/step_definitions/additional_cli_steps.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
set_environment_variable('RUBYOPT', ENV['RUBYOPT'] + " -I#{gem_dir}/lib")
115115
end
116116

117-
When "I accept the recommended settings by removing `=begin` and `=end` from `spec/spec_helper.rb`" do
117+
When('I accept the recommended settings by removing `=begin` and `=end` from `spec_helper.rb`') do
118118
cd('.') do
119119
spec_helper = File.read("spec/spec_helper.rb")
120120
expect(spec_helper).to include("=begin", "=end")

‎features/support/diff_lcs_versions.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
require 'diff-lcs'
22

33
Around "@skip-when-diff-lcs-1.4" do |scenario, block|
4-
if Diff::LCS::VERSION.to_f >= 1.4
5-
warn "Skipping scenario #{scenario.title} on `diff-lcs` v#{Diff::LCS::VERSION.to_f}"
4+
if Diff::LCS::VERSION >= '1.4'
5+
skip_this_scenario "Skipping scenario #{scenario.name} on `diff-lcs` v#{Diff::LCS::VERSION}"
66
else
77
block.call
88
end
99
end
1010

1111
Around "@skip-when-diff-lcs-1.3" do |scenario, block|
12-
if Diff::LCS::VERSION.to_f < 1.4
13-
warn "Skipping scenario #{scenario.title} on `diff-lcs` v#{Diff::LCS::VERSION.to_f}"
12+
if Diff::LCS::VERSION < '1.4'
13+
skip_this_scenario "Skipping scenario #{scenario.name} on `diff-lcs` v#{Diff::LCS::VERSION}"
1414
else
1515
block.call
1616
end

‎features/support/jruby.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
Around "@broken-on-jruby-9000" do |scenario, block|
22
require 'rspec/support/ruby_features'
3-
block.call unless RSpec::Support::Ruby.jruby_9000?
3+
if RSpec::Support::Ruby.jruby_9000?
4+
skip_this_scenario "Skipping scenario #{scenario.name} not supported on JRuby 9000"
5+
else
6+
block.call
7+
end
48
end

‎features/support/require_expect_syntax_in_aruba_specs.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
if defined?(Cucumber)
22
require 'shellwords'
3-
Before('~@allow-should-syntax', '~@with-clean-spec-opts') do
3+
use_tilde_tags = !defined?(::RUBY_ENGINE_VERSION) || (::RUBY_ENGINE_VERSION < '2.0.0')
4+
exclude_allow_should_syntax = use_tilde_tags ? '~@allow-should-syntax' : 'not @allow-should-syntax'
5+
exclude_with_clean_spec_ops = use_tilde_tags ? '~@with-clean-spec-opts' : 'not @with-clean-spec-opts'
6+
Before(exclude_allow_should_syntax, exclude_with_clean_spec_ops) do
47
set_environment_variable('SPEC_OPTS', "-r#{Shellwords.escape(__FILE__)}")
58
end
69

‎features/support/rubinius.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@
22
ENV['RBXOPT'] = "#{ENV["RBXOPT"]} -Xcompiler.no_rbc"
33

44
Around "@unsupported-on-rbx" do |scenario, block|
5-
block.call unless defined?(Rubinius)
5+
if defined?(Rubinius)
6+
block.call
7+
else
8+
skip_this_scenario "Skipping scenario #{scenario.name} not supported on Rubinius"
9+
end
610
end

‎features/support/ruby_27_support.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
if RUBY_VERSION.to_f == 2.7
33
block.call
44
else
5-
warn "Skipping scenario #{scenario.title} on Ruby v#{RUBY_VERSION}"
5+
skip_this_scenario "Skipping scenario #{scenario.name} on Ruby v#{RUBY_VERSION}"
66
end
77
end

‎rspec-core.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Gem::Specification.new do |s|
4545
s.add_runtime_dependency "rspec-support", "~> #{RSpec::Core::Version::STRING.split('.')[0..1].concat(['0']).join('.')}"
4646
end
4747

48-
s.add_development_dependency "cucumber", "~> 1.3"
48+
s.add_development_dependency "cucumber", ">= 1.3"
4949
s.add_development_dependency "minitest", "~> 5.3"
5050
s.add_development_dependency "aruba", "~> 0.14.9"
5151

0 commit comments

Comments
 (0)