Skip to content
This repository was archived by the owner on May 8, 2026. It is now read-only.

[guides] Testing - how to set up rom-factories#275

Open
JulienAmoros wants to merge 2 commits into
rom-rb:mainfrom
JulienAmoros:guides_testing-factories
Open

[guides] Testing - how to set up rom-factories#275
JulienAmoros wants to merge 2 commits into
rom-rb:mainfrom
JulienAmoros:guides_testing-factories

Conversation

@JulienAmoros
Copy link
Copy Markdown
Contributor

As we were using ROM, we decided to write an article about how to use 'rom-factory' gem, we think it's a must-have tool when using ROM and we wanted to share this knowledge.

What do you think about this?

@JulienAmoros JulienAmoros changed the title Guides testing factories [guides] Testing - how to set up rom-factories Apr 11, 2019
@JulienAmoros JulienAmoros force-pushed the guides_testing-factories branch from b6d12a7 to e379181 Compare April 11, 2019 15:51
@JulienAmoros JulienAmoros force-pushed the guides_testing-factories branch from e379181 to acc4cdd Compare April 11, 2019 15:53
Copy link
Copy Markdown
Contributor

@ianks ianks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept +1. Can you address the requested changes and quickly run the content through a spell checker such as Grammarly?

ROMFactory comes with Faker gem:

```ruby
YourFactory.define(:foo) do |f|
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we rename YourFactory to Factory

f.sequence(:name) { |n| "User#{n}" }
f.website 'http://personal.website'
f.some_integer 42
f.created_at Time.now.utc
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make generating the time a block, so each created record has a new timestamp. This is more realistic in testing since records created later in the spec will have an increasing created_at

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants