-
Notifications
You must be signed in to change notification settings - Fork 368
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
Minitest assertions and indexing controls. #396
Conversation
@@ -1230,6 +1231,12 @@ rake chewy:update[-users,projects] # updates every index in application except s | |||
|
|||
Just add `require 'chewy/rspec'` to your spec_helper.rb and you will get additional features: See [update_index.rb](lib/chewy/rspec/update_index.rb) for more details. | |||
|
|||
### Minitest integration | |||
|
|||
Add `require 'chewy/minitest/helpers'` to your test_helper.rb, and then for tests which you'd like indexing enabled, `include Chewy::Minitest::Helpers`. |
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.
require 'chewy/minitest'
?
Does it makes sense to add some specs for this? |
@pyromaniac yes, and I'll add them 👍 |
@pyromaniac I'd appreciate another look when you have a chance. I had a bit of a brain warp wiring up rspec to test the minitest helper, and I'm pretty out of date on my rspec style, but I think it's at least mostly tested. |
I'm having a hard time replicating the test failures Travis is reporting on my workstation. I had not been running Ruby 2.0.0-p598, but even after installing it I don't see those failures. They appear to be indicating that the version of active support it's loading with |
It seems to be about AS < 4.2, it is not about ruby |
Everything seems to be ok, just fix the specs and I'll merge it |
Hey, is it ready? |
Yep. Thanks!
|
Great job! Thanks! |
This adds support for index update assertions, and methods to control search index cleaning in a Minitest environment.
Critiques and suggestions welcome. One necessary improvement is better integration with the Chewy ORM interoperability layer. Currently the
SearchIndexReceiver#indexed?
and#deleted?
methods expect an object to respond to#id
. I'm happy to continue the work and enhance the integration if it's welcome, but I'd like some feedback before investing more time into it. We are currently using these testing helpers as is and they're functional for our needs.The ideas and implementation in the
SearchIndexReceiver
mock class is largely ported directly from therspec/update_index
implementation ofupdate_index
and friends. I'm sure it would be possible to make both test suites leverage the functionality if desired, but my rspec is rusty at best.Additions to a project
test_helper.rb
:And to an example test file:
Related to #392