I know that seeding test database is a kind of bad idea. I need to test Stripe api communication in my model tests. I know that external requests in Unit tests is a bad idea too, but nevertheless.
The stripe account has static subscription plan names. So when I test functionality linked with Stripe I need to take them from my database. I use Factory girl gem as a fixture source, but since I need only particular names for Stripe plans I hardcoded them to the factory:
factory :subscription_type do
name "Personal"
frequency "month"
stripe_plan_id "personal"
end
Other factories that uses this one is trying to create each time new object with the same field values and due to validation of uniqueness on the subscription_type model, the factories throw errors. I would prefer if they all use the same record (if exists) if called in one example.
What is the best practice here, guys?