thoughtbot / factory_bot

A library for setting up Ruby objects as test data.

Home Page:https://thoughtbot.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

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:

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

Just ran into this myself, it appears due to 36bd065 .

I just ran into this on a JRuby 9.3 project (2.6 parser).