Skip to content

Update cucumber #2518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,7 @@ RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w[--color]
end

Cucumber::Rake::Task.new(:cucumber) do |t|
string_version = ENV.fetch("RAILS_VERSION", "~> 6.0.0")
version =
if string_version == "master" || string_version.nil?
Float::INFINITY
else
string_version[/\d[\.-]\d/].tr('-', '.')
end
tags = []

if version.to_f >= 6.0
tags << "~@rails_pre_6"
end

if version.to_f < 6.0
tags << "~@rails_post_6"
end

cucumber_flag = tags.map { |tag| "--tag #{tag}" }

t.cucumber_opts = cucumber_flag
end
Cucumber::Rake::Task.new(:cucumber)

namespace :generate do
desc "generate a fresh app with rspec installed"
Expand Down
4 changes: 2 additions & 2 deletions cucumber.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
default: --require features --format progress --tags ~@wip
pretty: --require features --format pretty --tags ~@wip
default: --require features --format progress --tags 'not @wip'
pretty: --require features --format pretty --tags 'not @wip'
wip: --require features --tags @wip
22 changes: 22 additions & 0 deletions features/support/rails_versions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def rails_version
string_version = ENV.fetch("RAILS_VERSION", "~> 6.0.0")
if string_version == "master" || string_version.nil?
Float::INFINITY
else
string_version[/\d[\.-]\d/].tr('-', '.')
end
end

Before "@rails_pre_6" do |scenario|
if rails_version.to_f >= 6.0
warn "Skipping scenario #{scenario.name} on Rails v#{rails_version}"
skip_this_scenario
end
end

Before "@rails_post_6" do |scenario|
if rails_version.to_f < 6.0
warn "Skipping scenario #{scenario.name} on Rails v#{rails_version}"
skip_this_scenario
end
end
2 changes: 1 addition & 1 deletion rspec-rails.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ Gem::Specification.new do |s|

s.add_development_dependency 'ammeter', '~> 1.1.5'
s.add_development_dependency 'aruba', '~> 0.14.12'
s.add_development_dependency 'cucumber', '~> 1.3.5'
s.add_development_dependency 'cucumber', '>= 3.2', '!= 4.0.0', '< 8.0.0'
end