0

Getting below error message when running Rspec after upgrading Ruby to 3.0.3

Failure/Error: FactoryBot.lint strategy: :build_stubbed

FactoryBot::InvalidFactoryError: The following factories are invalid:

  • user - wrong number of arguments (given 1, expected 0; required keywords: event_type, object, summary, author) (ArgumentError)
JohnSmith
  • 1,078
  • 1
  • 10
  • 21
  • 2
    You are going to need to provide a bit more context I think (code that is broken, gem versions, etc.) but the issue you are running into is ruby 3.0's separation of positional and keyword arguments [See Here](https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/). Seems alot of people are upgrading to ruby 3 as I have seen this question asked in all sorts of flavors lately. – engineersmnky Jan 20 '23 at 20:52
  • do you mind pointing me to the other questions you have seen? – JohnSmith Jan 20 '23 at 20:53
  • 1
    https://stackoverflow.com/questions/75160101/upgade-to-ruby-3-1-breaks-code-when-using-csv-class-from-standard-library/75161043#75161043 https://stackoverflow.com/questions/75164905/ruby-bundlers-mustermann-initialize-wrong-number-of-arguments-given-2-expe#comment132640402_75164905 – engineersmnky Jan 20 '23 at 20:55

1 Answers1

0

We had the same problem and after some research found it that the sentence Faker.Number.number(9) should be modify according to the new ruby standard for arguments ruby 3.0's separation of positional and keyword arguments. As you can find on See Here! like https://stackoverflow.com/users/1978251/engineersmnky refer.

ERROR GOOD
Faker.Number.number(9) Faker.Number.number(digits: 9).

The following factories are invalid: server-test-web-1 | server-test-web-1 | * admin - wrong number of arguments (given 1, expected 0)

alectrico
  • 15
  • 6