title: Specify fields you want on FactoryBot
body: <p>I have an object that takes the information from a rest API. Let's say I call Posts from an API and I can specify which fields I want to extract. Just an example of how it looks:</p>
  
  <pre><code>Post.find!(id: 1, fields: [:id, :title, :description])
  </code></pre>
  
  <p>This does an API call and it returns me a Post object with these specified fields.</p>
  
  <p>For testing, I am stubbing this API call with Factory Bot and returns directly a Post object with all possible fields it can query. </p>
  
  <p>This approach is not the best since the tests are always returning all fields and code itself maybe I just need a couple of fields not all of them</p>
  
  <p>So I am trying to achieve something like (in FactoryBot): </p>
  
  <p><code>build(:post, fields: [:id,:title])</code> and set up a Post object just with id and title.</p>
  
  <p>If I do <code>build(:post, fields: [:title, :created_at])</code> and set up a Post object just with title and created_at. And so on...</p>
  
  <p>Did some research and trying some ideas,  but failed in all of them about how to build this flow.</p>
  
  <p>Any idea about how to achieve this behavior?</p>
  
  <p><strong>EDIT</strong>
  Traits seems a nice alternative, but I must be as consistent as the API call, specifying these <code>fields</code>. So traits are not working for me...</p>