It's half unsolved, but it's a story of making a portfolio and doing something like this ... I got a title error when executing the unit test code of the model, but I did not find a similar case when I searched, so I wrote it. Briefly, I will only describe the conclusions and first aid.
The instance was organized using FactoryBot, but an error occurred due to the following description. As a first aid, the error disappeared when I deleted it.
spec/factories/contents.rb
association :user
It's Factory Bot association. I wrote it because I want to pull the data in the users table. This isn't strange in itself, but I think it's because there's a problem writing another code and it's not working. We are investigating the cause, but if we can't do this, we can't test it, so I'd like to write it separately.
If you get the same error, you may want to doubt the above.
I found out why the association didn't work. The bottom line is that the instance of spec / factories / user.rb was empty.
spec/factories/user.rb
FactoryBot.define do
factory :user do
end
end
For some reason, I just thought I had already written it. It's natural that it doesn't work. .. .. So I should have doubted that the association was able to write properly in the first place.