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?
name { 'John }inside the factory should work. If you have uniqueness validation on the column, it should fail with a different error. If you're declaring a let var in rspec, then you'd do something likelet(:user) { create :user, name: 'John' }. Could you add more detail about the model and factory? - Allison