I'm using FactoryBot to help test my Rails application.
It works great, except I get an error when trying to define a text field.
For a string, you simply use name { "John" }
, but I have one row, method, in my db which is a text field. When I try to define that row as follows:
method { "Some method here" }
it returns
ArgumentError:
wrong number of arguments (given 0, expected 1)
Anyone know the syntax to define a text field with FactoryBot?
method
is defined on Object
by Ruby. If your table column is called "method", you're going to run into all sorts of issues. You may be able to work around this specific error, but more will likely crop up. My best advice would be to rename your column and move on.
Edit: To clarify - this has nothing to do with your column type. It has to do with your column being named "method."