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

Already on GitHub? Sign in to your account

Fixes #290 bulk store escape broken #291

wants to merge 2 commits into


None yet
2 participants

sarmiena commented Mar 25, 2012

No description provided.


sarmiena commented on 40f99ff Mar 25, 2012

FAIL test: Index when storing in bulk namespaced instances should serialize namespaced ActiveRecord objects. (1:00:52.861)
unexpected invocation: Tire::HTTP::Client::RestClient.post('http://localhost:9200/_bulk', '{'index':{'_index':'active_record_namespace_my_models','_type':'active_record_namespace%2Fmy_model','_id':'1'}}\n{'timestamp':null,'title':'One'}\n{'index':{'_index':'active_record_namespace_my_models','_type':'active_record_namespace%2Fmy_model','_id':'2'}}\n{'timestamp':null,'title':'Two'}\n')
unsatisfied expectations:
- expected exactly once, not yet invoked: Tire::HTTP::Client::RestClient.post()

    @ lib/tire/index.rb:85:in `bulk_store'

Offending portion of the test:

json =~ /"_type":"active_record_namespace/my_model"/ results in nil being returned
_type is being saved as "active_record_namespace%2Fmy_model"

Passing tests
Storing individual namespaced records saves _type as "my_namespace/my_model", but bulk_store was saving _type as "my_namespace%2Fmy_model". This resulted in two different document types where there should only be one.

@karmi karmi closed this in 4a92865 Mar 27, 2012


karmi commented Mar 27, 2012

@sarmiena Cleaned up the commit, and merged. Thanks for looking into it, I think everything works fine with namespaced models now.

Also, I reverted changes to the ActiveRecord tests (not really helpful, seems to me? let's prefer simplicity in tests), and added a more lightweight unit test implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment