Mechanism for Using Emepheral Database Records in Previews #1588
-
Feature requestSome mechanism similar to RSpec MotivationWe often pass active record objects into our components. Currently, we fetch records and hope they have the properties we need. What would be great is if we could use factory_bot or similar to create the exact records we need for a preview. We could do that currently, but it would pollute our local database each time we view the preview. It'd be nice if we could generate the markup and then throw away the records similar to how a component spec works. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hi @dyeje! Have you tried wrapping the |
Beta Was this translation helpful? Give feedback.
-
I've implemented similar in the past, but instead of using real records I used FactoryBot's |
Beta Was this translation helpful? Give feedback.
I've implemented similar in the past, but instead of using real records I used FactoryBot's
build
andbuild_stubbed
functionality to avoid having to deal with creating real records in the environments you're running previews in.