-
Notifications
You must be signed in to change notification settings - Fork 1
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 reset! command #3
Conversation
I was thinking about this sort of functionality as well, but this seems like the poster-child use-case for a stateful class. I was thinking something like
I think this could do everything as a reset command, plus more, in a more intuitive manner. Any thoughts about this? The downsides of the module-level approach is that it could use a lot of memory if left running for a long time, whereas the class approach would work very well for testing and shouldn't leak memory. If it's used outside of testing, anyway. The purpose of this gem when written was mainly for testing and db seeding with faker. |
I tested this approach with |
@@ -0,0 +1,29 @@ | |||
describe Unique do | |||
context '.reset!' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be added to spec/unique/unique_spec.rb
instead of here so CI will run this. It looks good otherwise. https://travis-ci.org/b264/unique/jobs/164806377#L165
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rake
or rake default
should run the tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed and rebased.
Stateful makes sense, but I also had concerns about that functioning with RSpec. |
released as |
Allow users to clear our current object cache. This is particularly useful when Unique is being used in combination with RSpec and Faker.