Closed arowan closed 8 years ago
My fabricator
Fabricator(:message) do user subject { Faker::Lorem.sentence } body { Faker::Lorem.paragraph } end
let(:message_attributes) { Fabricate.attributes_for(:message, user: nil) }
I'm setting user to nil and it's throwing this error:
ActiveRecord::AssociationTypeMismatch: User(#70254248807040) expected, got String(#70254193623120)
<ActionController::Parameters {"message"=>{"body"=>"Odit consectetur est exercitationem delectus placeat corrupti. Commodi ut et suscipit.", "subject"=>"Porro odio voluptates.", "user"=>""}, "format"=>"json", "controller"=>"internal/messages", "action"=>"create"} permitted: false>
It looks like it's returning user as a blank string. Maybe I'm going about this the wrong way?
The Fabrication gem is working properly and returning a nil value. It's something else, so I've closed this issue.
My fabricator
I'm setting user to nil and it's throwing this error:
It looks like it's returning user as a blank string. Maybe I'm going about this the wrong way?