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

Add factory_bot lint test to core #3647

Merged
merged 1 commit into from Jun 4, 2020

Conversation

seand7565
Copy link
Contributor

@seand7565 seand7565 commented May 30, 2020

THIS PR SPONSORED BY Super Good Software

Description

Adds a test that lints FactoryBot. Also makes changes to two tests to
conform to the lint - store_credit_event_factory needs to have an
action, even if the action is replaced with one of the sub factories.
store_credit_reason_factory tripped the linter because of a uniqueness
contraint for the name - should not come up in normal testing, but I
added a sequencer to account for it in the linter anyway.

The linter ignores just one factory - customer_return_without_return_items
this factory is intentionally invalid (see:
customer_return_factory_spec.rb
).. though I think we should re-evaluate that, maybe open an issue for changing it.

This PR is attempting to close (at the time of writing) the oldest issue for Solidus, #568

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

Copy link
Member

@jarednorman jarednorman left a comment

Choose a reason for hiding this comment

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

Do we want this as part of our RSpec core tests or do we want it as a separate task? I don't have a particular opinion either way, but I thought it worth considering.


Side note: I'm going to refrain from approving this PR since technically I sponsored it, even though @seand7565 selected this task himself.

core/spec/lib/factory_spec.rb Outdated Show resolved Hide resolved
core/spec/lib/factory_spec.rb Outdated Show resolved Hide resolved
@aldesantis
Copy link
Member

I think it's okay for this to be part of the test suite, just left a couple of minor comments!

Adds a test that lints FactoryBot. Also makes changes to two tests to
conform to the lint - store_credit_event_factory needs to have an
action, even if the action is replaced with one of the sub factories.
store_credit_reason_factory tripped the linter because of a uniqueness
contraint for the name - should not come up in normal testing, but I
added a sequencer to account for it in the linter anyway.

The linter ignores just one factory - customer_return_without_return_items
this factory is intentionally invalid (see:
/core/spec/lib/spree/core/testing_support/factories/customer_return_factory_spec.rb#L37
)
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

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

@seand7565 thank you 👍

@aldesantis aldesantis merged commit 9c1d843 into solidusio:master Jun 4, 2020
@seand7565 seand7565 mentioned this pull request Jun 5, 2020
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.

None yet

5 participants