Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

JulienAmoros
Copy link
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
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
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
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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants