title: How to fix 'undefined method' enum in rspec test with FactoryBot?
body: <p>I'm trying to test an model I had created for my application, it has association with two other models, also using Factory Bot to build the test, however it does not recognize it, the error return is: <code>Failure/Error: status :pending //// NoMethodError: undefined method 'status' in 'pending' factory.</code></p>
  
  <p>I'm running the application with Ruby 2.6.1, Rails 5.2.3, FactoryBot 5.0.2, Rspec 3.8. I've tried the different ways to define an enum. I don't know what to do more.</p>
  
  <p>Model:</p>
  
  <pre><code>class CollegeWhitelist &lt; ApplicationRecord
      enum status: {pending: 0, approved: 1, rejected: 2}
  
      has_many :users
      has_many :colleges
  end
  </code></pre>
  
  <p>Factory:</p>
  
  <pre><code>FactoryBot.define do
    factory :college_whitelist do
      association :user
      association :college
  
      trait :pending do
        status :pending
      end
  
      trait :approved do
        status :approved
      end
  
      trait :rejected do
        status :rejected
      end
    end
  end
  </code></pre>
  
  <p>Rspec:</p>
  
  <pre><code>require 'rails_helper'
  
  RSpec.describe CollegeWhitelist, type: :model do
    describe "#consistency " do
      it 'cannot insert the same user for the same college in permissions' do
        @permission = build(:college_whitelist)
        p @permission
      end
    end
  end
  
  </code></pre>
  
  <p>I was expecting it to pass the test just printing the object at first.</p>