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

Requirable factories #2 #627

Merged
merged 83 commits into from Jan 6, 2016
Merged

Requirable factories #2 #627

merged 83 commits into from Jan 6, 2016

Conversation

mamhoff
Copy link
Contributor

@mamhoff mamhoff commented Dec 29, 2015

This PR builds on #623 (and includes @Sinetheta s work). I went through all factories, set up tests that don't require testing_support/factories, and made sure all factories build and create. As the factories are IMO code, and a pretty important part of the framework, I suggest to leave the tests in the repo. They can later be used to improve the factories even more. I do understand they seem pretty bogus at times, but having a systematic way of testing factories is a nice thing.

@jhawthorn
Copy link
Contributor

Isn't setting ENV['NO_FACTORIES'] = "NO FACTORIES" going to cause require order issues? If one of the factory specs is loaded before the other specs in our system I fear all factories will not be loaded, though they should be. I don't think "other factories not loaded" is something we can test for.

Otherwise I love the factory specs.

@cbrunsdon
Copy link
Contributor

I'm also not really excited about the env check, I know it means we have a test to make sure that factories would be individually loadable, but I'm not sure thats worth the potential extra issues by controlling loading with ENV settings. Will think about it.

Tests on our factories if fantastic though, thanks for the effort. The huge reliance on our factories by ourselves and other projects without any reasonable suite has always been a black mark on the project IMO.

@mamhoff
Copy link
Contributor Author

mamhoff commented Dec 29, 2015

The ENV check was necessary for testing the requireability of the factories. I entirely understand the ugliness of it.

I'll remove it - for knowing whether any factories still break, we could do one of two things:

  1. Just wait for the community to cry when a factory does not load individually (probably only happens for a couple of popular factories (order, shipment, payment, line_item)
  2. Remove loading all spree factories from the spec helper and load factories in individual spec files. That'd be a large amount of work though, and probably concern of another PR.

If anyone has a better idea on how to test requireability ... I'd be excited.

@cbrunsdon
Copy link
Contributor

We could look to do it outside of our specs as well just as a CI task.

While individually requirable is nice, I'd definitely say not worth confusing up our specs. I'd even say we try waiting on backlash for a while. We'll also be watching PR's to make sure we're not adding dependencies to factories without including them, so we might be optimising for a problem we won't have.

@mamhoff
Copy link
Contributor Author

mamhoff commented Dec 29, 2015

Switch removed :)

@cbrunsdon
Copy link
Contributor

As this is just going into Kevin's original PR I am 👍

@cbrunsdon
Copy link
Contributor

Whoops, sorry, missed where it was being targeted it to.

@@ -0,0 +1,9 @@
require 'factory_girl'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this file would be better under testing_support/factories (but I don't feel that strongly about it)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wouldn't mind doing that, but that was Kevin's decision, and I didn't want to touch his stuff. @Sinetheta should the file be moved?

@jhawthorn
Copy link
Contributor

👍 Regardless of my suggestion. This is great.

@jordan-brough
Copy link
Contributor

👍 thanks! Would you mind rebasing and resolving the merge conflicts? Looks like we're ready to merge after that.

@mamhoff
Copy link
Contributor Author

mamhoff commented Jan 6, 2016

@jordan-brough rebased!

@jordan-brough
Copy link
Contributor

Perfect, thanks again!

jordan-brough added a commit that referenced this pull request Jan 6, 2016
@jordan-brough jordan-brough merged commit 0f06aa1 into solidusio:master Jan 6, 2016
@mamhoff mamhoff deleted the requirable-factories branch January 17, 2016 17:12
tvdeyen added a commit that referenced this pull request Feb 3, 2017
In #627 we removed the hack around `Spree::Zone.global`.
This change is currently missing in the change log.
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.

5 participants