Skip to content

Commit

Permalink
Add support for cucumber 9 (#97)
Browse files Browse the repository at this point in the history
* Add support for cucumber 9

* update README, and run tests with Cucumber 9.x

---------

Co-authored-by: Mathieu Jobin <mathieu@justbudget.com>
  • Loading branch information
vlad-psh and mathieujobin committed Nov 17, 2023
1 parent 137c35d commit 5453a6a
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
rails: ["7.0", "6.1", "6.0"]
ruby: ["3.2.2", "3.1.4", "3.0.6", "2.7.8"]
cucumber: ["8.0", "7.0", "6.0", "5.0", "4.0", "3.0"]
cucumber: ["9.0", "8.0", "7.0", "6.0", "5.0", "4.0", "3.0"]

env:
RUBY_VERSION: ${{ matrix.ruby }}
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ gem "rails", "~> #{ENV['RAILS_VERSION'] || '7.0'}.0"
gem "cucumber", "~> #{ENV['CUKES_VERSION'] || '7.0'}"
gem "cucumber-rails"
gem 'fabrication', github: 'mathieujobin/fabrication', ref: '923cf6fcefd0566b1d6be7bd2f685b89388f4800'
gem 'sprockets-rails'
3 changes: 3 additions & 0 deletions History.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
== 0.9.0
* Added support for Cucumber 9.x

== 0.8.0
* Added support for Cucumber 8.x
* Removed support for Rails 4.2 -> 5.2
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ Cucumber 4.x - should work with all Rails 5.x versions, tests only run for 5.2 a
Cucumber 5.x - all tests pass for rails 5.2, 6.0 and 6.1
Cucumber 6.x - all tests pass for rails 6.0, 6.1 and 7.0
Cucumber 7.x - all tests pass for rails 6.0, 6.1 and 7.0
Cucumber 8.x - all tests pass for rails 6.0, 6.1 and 7.0
Cucumber 9.x - all tests pass for rails 6.0, 6.1 and 7.0

Please open pull-requests with fixes if you encounter any problems.
No active development on this gem.

### Rails 5 and Rails 6
### Rails 5.x, 6.x, and 7.x

Add the gem to your Gemfile:

Expand Down
8 changes: 3 additions & 5 deletions Rakefile.d/cucumber.rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ end
namespace :cucumber do
task :setup do
current_gemfile = ENV['BUNDLE_GEMFILE']
sh "BUNDLE_GEMFILE=#{current_gemfile} bundle show cucumber > /tmp/cukes_version"
sh "BUNDLE_GEMFILE=#{current_gemfile} bundle show sqlite3 > /tmp/sqlite_version"
cukes_version=File.read('/tmp/cukes_version').split('-').last.chomp
sqlite_version=File.read('/tmp/sqlite_version').split('-').last.chomp
cukes_version = Gem.loaded_specs['cucumber'].version
sqlite_version = Gem.loaded_specs['sqlite3'].version
puts "Versions: Cucumber #{cukes_version}, SQLite #{sqlite_version}."
Bundler.with_clean_env do
gemfile = "cucumber_test_app/Gemfile"
rm_rf "cucumber_test_app"
sh "BUNDLE_GEMFILE=#{current_gemfile} bundle exec rails new cucumber_test_app --skip-spring --skip-javascript --skip-sprockets --skip-bootsnap"
sh "echo 'gem \"cucumber\", \"~> #{cukes_version}\", :require => false' >> #{gemfile}"
sh "sed -i 's/gem .sqlite3./gem \"sqlite3\", \"~> #{sqlite_version}\"/' #{gemfile}"
sh "sed -i'' -e 's/gem .sqlite3./gem \"sqlite3\", \"~> #{sqlite_version}\"/' #{gemfile}"
sh "cat #{gemfile} | grep sqli"
sh "echo 'gem \"cucumber-rails\", :require => false' >> #{gemfile}"
sh "echo 'gem \"rspec-rails\", \"~>3.0\"' >> #{gemfile}"
Expand Down
12 changes: 12 additions & 0 deletions features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@
require 'cucumber/rails'
Capybara.default_selector = :css
ActionController::Base.allow_rescue = false

require 'database_cleaner/active_record'
DatabaseCleaner.strategy = :truncation

Around do |scenario, block|
DatabaseCleaner.cleaning(&block)
end

# 'Fixnum' and 'Bignum' are deprecated since ruby-3.2 (both replaced by 'Integer')
# But 'machinist' still uses 'Fixnum', so we have to use workaround:
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.2')
class Fixnum < Integer; end
end
2 changes: 1 addition & 1 deletion lib/pickle/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Pickle
VERSION = "0.8.0"
VERSION = "0.9.0"
end
2 changes: 1 addition & 1 deletion pickle.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.require_paths = ["lib"]

s.add_dependency "cucumber", ">=3.0", "< 9.0"
s.add_dependency "cucumber", ">=3.0", "< 10.0"
s.add_dependency "rake"

s.add_development_dependency "rack"
Expand Down

0 comments on commit 5453a6a

Please sign in to comment.