Using FactoryBot for Enum Testing
To speed up test writing, use FactoryBot:
FactoryBot.define do
factory :order do
status { :pending }
end
end
Then, in your test:
order = create(:order, status: :shipped)
expect(order.status).to eq("shipped")
This makes it easier to test different enum values without manually creating records.