You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Syntax error in factory_bot gem files when using Ruby 2.7.0.
Reproduction Steps
Install Ruby 2.7.0.
Create a new Rails application.
Add the factory_bot_rails gem to the Gemfile.
Run bundle install.
Create a test file that uses FactoryBot.
Run the test with rspec.
Expected Behavior
The test should run without errors.
Actual Behavior
A syntax error occurs in factory_bot gem files, such as evaluator.rb and definition_proxy.rb, preventing the test from running. The error message points to lines of code using the method_missing and sequence methods.
1. File : evaluator.rb
Correction:
Add the *args and &block parameters to the method_missing method definition
The corrections involve adding the parameters *args and &block to the method_missing and sequence methods to ensure compatibility with Ruby 2.7.0 syntax.
System Configuration
factory_bot_rails version: 6.4.5
factory_bot version: 6.4.5
rails version: 6.0.0
ruby version: 2.7.0
The text was updated successfully, but these errors were encountered:
Description
Syntax error in factory_bot gem files when using Ruby 2.7.0.
Reproduction Steps
factory_bot_rails
gem to the Gemfile.bundle install
.FactoryBot
.rspec
.Expected Behavior
The test should run without errors.
Actual Behavior
A syntax error occurs in
factory_bot
gem files, such asevaluator.rb
anddefinition_proxy.rb
, preventing the test from running. The error message points to lines of code using themethod_missing
andsequence
methods.1. File :
evaluator.rb
Correction:
Add the
*args
and&block
parameters to themethod_missing
method definition2. File :
definition_proxy.rb
Correction:
The
method_missing
method definition is already correct. Change thesequence
method definition to:3. File :
default.rb
Correction:
Change the
sequence
method definition to::The corrections involve adding the parameters
*args
and&block
to themethod_missing
andsequence
methods to ensure compatibility with Ruby 2.7.0 syntax.System Configuration
The text was updated successfully, but these errors were encountered: