Factory Bot 6.4.5: Syntax error with Ruby < 2.7, but the ruby gem requirement is still `>= 2.5.0`
tagliala opened this issue · comments
Geremia Taglialatela commented
Description
Factory Bot 6.4.5 contains syntax which is not compatible with Ruby < 2.7, but the ruby gem requirement is still >= 2.5.0
Probably introduced in: #1612
I understand that the intent is to drop Ruby < 3.0, but the requirement in the Gemfile was not updated accordingly.
I would suggest to yank 6.4.5 and release 6.4.6 with the minimum ruby version at 3.0
Ref:
- https://github.com/thoughtbot/factory_bot/blob/main/factory_bot.gemspec#L18
- https://github.com/diowa/ruby2-rails5-bootstrap-heroku/actions/runs/7375030629/job/20066130892#step:6:7
Reproduction Steps
Run the following script:
# frozen_string_literal: true
require 'bundler/inline'
begin
gemfile(true) do
source 'https://rubygems.org'
gem 'factory_bot', '6.4.5'
end
puts "\nRuby version: #{RUBY_VERSION}"
rescue Gem::LoadError => e
puts "\nMissing Dependency:\n#{e.backtrace.first} #{e.message}"
rescue LoadError => e
puts "\nError:\n#{e.backtrace.first} #{e.message}"
puts DATA.read
exit 1
end
require 'factory_bot'
Expected behavior
No raise
Actual behavior
~/.rvm/gems/ruby-2.5.9/gems/factory_bot-6.4.5/lib/factory_bot.rb:25:in `require': ~/.rvm/gems/ruby-2.5.9/gems/factory_bot-6.4.5/lib/factory_bot/evaluator.rb:38: syntax error, unexpected ... (SyntaxError)
...method_missing(method_name, ...)
... ^~~
~/.rvm/gems/ruby-2.5.9/gems/factory_bot-6.4.5/lib/factory_bot/evaluator.rb:40: syntax error, unexpected ..., expecting ')'
...@instance.send(method_name, ...)
... ^~~
~/.rvm/gems/ruby-2.5.9/gems/factory_bot-6.4.5/lib/factory_bot/evaluator.rb:42: syntax error, unexpected ..., expecting ')'
...unner.new.send(method_name, ...)
... ^~~
~/.rvm/gems/ruby-2.5.9/gems/factory_bot-6.4.5/lib/factory_bot/evaluator.rb:80: syntax error, unexpected end-of-input, expecting keyword_end
System configuration
factory_bot version: 6.4.5
rails version: n/a
ruby version: 2.6.10, 2.5.9
Kyle Fazzari commented
Just ran into this myself, it appears due to 36bd065 .
John Bolliger commented
I just ran into this on a JRuby 9.3 project (2.6 parser).