Testing with ROM

So in previous apps with ActiveRecord I have used FactoryGirl heavily for providing DB test data without having to write static fixtures for everything.

Wondering if anyone is using ROM on a project and has solved this for themselves or not? I can’t find any FG-like libraries for the ROM api.

Based on the fact that the API is built by hand in repos I’m not even sure it would be possible, let alone easy.

Real world experiences would be great, thanks.


1 Like

Can’t say much about testing atm, but I’m aware of one FactoryGirl analog for ROM https://github.com/janjiss/rom_factory

We use rom_factory at Icelab, but this gem needs more work. I added a slightly nicer DSL on top of its API with a built-in integration with faker gem (not OSSed yet) and I’d like to work with the rom_factory gem author and make it more flexible (I’ll open a PR with the improvements I’ve made). ie we need a pure data generator first, and then integration with rom for cases when you want to persist generated data. We also need rom_factory to produce structs that are compatible with our common APIs (ie they should quack like rom/dry structs), and some features related to associations are needed too.

1 Like