Skip to content

Commit

Permalink
Fix Ruby 3.4 specs by upgrading aruba from 0.x to 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
makmic committed Jan 20, 2025
1 parent 1f29086 commit 88b1d46
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 17 deletions.
1 change: 1 addition & 0 deletions Gemfile.cucumber-9.2
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ gem 'ostruct' # Bundled gem since Ruby 3.4
gem 'base64' # Bundled gem since Ruby 3.4
gem 'bigdecimal' # Bundled gem since Ruby 3.4
gem 'mutex_m' # Bundled gem since Ruby 3.4
gem 'logger' # Bundled gem since Ruby 3.4

# Runtime dependencies
gem 'cucumber', '~> 9.2.1'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.cucumber-9.2.lock
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ GEM
ffi (1.17.1-x86_64-linux-gnu)
ffi (1.17.1-x86_64-linux-musl)
gemika (0.8.4)
logger (1.6.5)
mini_mime (1.1.5)
multi_test (1.1.0)
mutex_m (0.3.0)
Expand Down Expand Up @@ -97,6 +98,7 @@ DEPENDENCIES
cucumber (~> 9.2.1)
cucumber_priority!
gemika (>= 0.8.1)
logger
mutex_m
ostruct
rake (> 10.0)
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,16 @@ There are tests in `spec`. We only accept PRs with tests. To run tests:

We recommend to test large changes against multiple versions of Ruby and multiple dependency sets. Supported combinations are configured in `.github/workflows/test.yml`. We provide some rake tasks to help with this:

- Run tests for a specific version of Ruby, Bundler and Gemfile:
```sh
rbenv shell 3.4.1
export BUNDLE_GEMFILE=Gemfile.cucumber-9.2
bundle _2.6.3_ install
bundle _2.6.3_ exec rake current_rspec
```
- Install development dependencies using `bundle matrix:install`
- Run tests using `bundle matrix:spec`
- Run tests for all rubies:

```sh
for version in "2.5.3" "2.6.6" "2.7.2" "3.2.0" "3.3.6" "3.4.1"; do rbenv shell $version && bundle install && bundle exec rake matrix:install && bundle exec rake matrix:spec; done
Expand Down
2 changes: 2 additions & 0 deletions spec/fixtures/features/support/aruba.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'aruba/cucumber'
require 'cucumber_priority'
16 changes: 1 addition & 15 deletions spec/support/aruba.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1 @@
require 'aruba/api'
require 'aruba/in_process'
require 'cucumber/cli/main'

Aruba.process = Aruba::InProcess
Aruba::InProcess.main_class = Cucumber::Cli::Main

Gemika::RSpec.configure do |config|
config.include Aruba::Api

config.before(:each) do
restore_env
clean_current_dir
end
end
require 'aruba/rspec'
4 changes: 2 additions & 2 deletions spec/support/cucumber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class << self
end

def create_empty_cucumber_project
in_current_dir do
in_current_directory do
FileUtils.cp_r(File.expand_path(File.join(__FILE__, '..', '..', 'fixtures', 'features')), 'features')
end
end
Expand All @@ -22,7 +22,7 @@ def run_scenario(content, options = {})
#{content}
GHERKIN
run_simple("cucumber #{feature_path}", options.fetch(:fail_on_error, true))
run_command_and_stop("cucumber #{feature_path}", options.slice(:fail_on_error))
end
end

Expand Down

0 comments on commit 88b1d46

Please sign in to comment.