Skip to content

Conversation

@obrie
Copy link
Contributor

@obrie obrie commented Dec 23, 2025

This adds support for Ruby 4.0. Note this is currently broken for flatware-cucumber due to a change in Ruby that was fixed here: cucumber/cucumber-ruby-core#302

Opening this PR to start a discussion around how you want to move forward to address this. We could change the minimum version require for flatware-cucumber. I haven't spent time thinking through potential alternatives yet. Example of failure:

  1) Flatware::Cucumber.configure copies the arguments into each job
     Failure/Error: cli_config.parse! args + %w[--format Flatware::Cucumber::Formatter]
     
     Cucumber::Cli::YmlLoadError:
       cucumber.yml was found, but could not be parsed with ERB.  Please refer to cucumber's documentation on correct profile usage.
       #<ArgumentError: wrong number of arguments (given 3, expected 1)>
     # ./lib/flatware/cucumber.rb:38:in 'Flatware::Cucumber.configure'
     # ./spec/flatware/cucumber_spec.rb:7:in 'block (3 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # ArgumentError:
     #   wrong number of arguments (given 3, expected 1)
     #   ./lib/flatware/cucumber.rb:38:in 'Flatware::Cucumber.configure'

  2) Flatware::Cucumber run with multiple scenarios in the same file calls the steps the correct number of times
     Failure/Error: puts event.inspect
     
     ArgumentError:
       wrong number of arguments (given 5, expected 2)
     # ./lib/flatware/cucumber/formatter.rb:53:in 'Kernel#inspect'
     # ./lib/flatware/cucumber/formatter.rb:53:in 'Flatware::Cucumber::Formatter#on_step_activated'
     # ./lib/flatware/cucumber.rb:44:in 'Flatware::Cucumber.run'
     # ./spec/flatware/cucumber_spec.rb:39:in 'block (5 levels) in <top (required)>'
     # ./spec/flatware/cucumber_spec.rb:38:in 'Dir.chdir'
     # ./spec/flatware/cucumber_spec.rb:38:in 'block (4 levels) in <top (required)>'

@obrie
Copy link
Contributor Author

obrie commented Dec 23, 2025

When running this on newer versions of cucumber, we get:

  1) Flatware::Cucumber run with multiple scenarios in the same file calls the steps the correct number of times
     Failure/Error: expect(Flatware).to have_received(:ran).with(3)
     
       Flatware received :ran with unexpected arguments
         expected: (3)
              got: (1) (1 time)
                   (2) (1 time)
     # ./spec/flatware/cucumber_spec.rb:47:in 'block (5 levels) in <top (required)>'
     # ./spec/flatware/cucumber_spec.rb:41:in 'Dir.chdir'
     # ./spec/flatware/cucumber_spec.rb:41:in 'block (4 levels) in <top (required)>'

I haven't quite figured that one out either.

@obrie
Copy link
Contributor Author

obrie commented Jan 2, 2026

@briandunn I think this is ready for review. At least, all specs are now passing :)

@briandunn
Copy link
Owner

@obrie I am so excited about this! There is a lot here I've been meaning to get to for a long time. Gonna review and merge soon. Thank you!

Copy link
Owner

@briandunn briandunn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much!

# step definitions are available on every runtime *and* also ensure Cucumber isn't memoizing the feature files
# to run.
#
# For now, the legacy autoloader is the only option to keep everything working properly.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am so happy you figured this out! Had me stuck. Also, I think we're gonna phase out cucumber support I don't think many are using it. (do you?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to help 😄

I've never used cucumber myself. I can't think of too many open-source projects I've seen that have used cucumber either. Based on the number of installs of flatware-cucumber, doesn't seem like there are that many folks who use both flatware and cucumber.

@briandunn briandunn merged commit 0403ac1 into briandunn:master Jan 9, 2026
38 checks passed
@mjankowski
Copy link
Contributor

Thanks for merging this. Can confirm it works just fine on a WIP ruby 4.0 upgrade branch. Release soon?

Separately - we also dont need the cucumber support. Just using flatware as parallelizing wrapping around pretty vanilla rspec suite.

@mjankowski
Copy link
Contributor

@briandunn anything we can do to assist in version release? Would a PR with the version update help? Anything more you want to fit in prior to that?

@briandunn
Copy link
Owner

briandunn commented Jan 22, 2026 via email

@mjankowski
Copy link
Contributor

The Gemfile.lock is gitignored ... so I think there isnt really a specific bundle version?

That said, yes, I think that cop was renamed at some point, so it could be that you are running older rubocop and hitting that error? If you upgrade to latest rubocop (1.82.1) does that go away?

@briandunn
Copy link
Owner

briandunn commented Jan 22, 2026 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants