-
Notifications
You must be signed in to change notification settings - Fork 534
Connects to search server on application boot - problem with WebMock #136
Comments
Hi, yeah, Tire models check with the ES server if the corresponding index exists or not, so they know if they should create it or not. You should mock the HEAD request with WebMock/FakeWeb, etc. Do you have any specific tip where & how to mention it in the Readme? |
Hi, thanks, I'll close this for now, and will keep the note about instructing users to mock ES requests in their unit tests in mind... |
I'm having the same issue. Used the trick with |
@RKushnir which "trick" and why doesn't it feel "quite right"? |
@karmi From the first post:
I think, this is rather the issue of webmock, it should allow to configure when to turn it on. Maybe, start as disabled by default. |
Yeah, Fakeweb has a reversed approach, by default all requests are allowed. Maybe the code in test helpers could be structured so that Webmock and it's definition are loaded first, and Tire is loaded afterwards? We |
Sorry for replying to a 1 year old issue. However I've found this to work as well: require 'webmock'
WebMock.disable_net_connect!(:allow_localhost => true) I think this way is better than |
Hey @karmi,
I upgraded to
0.3.8
today and noticed that my tests started to fail. I didn't add other gems. This is the error I got:I use WebMock because that's one of the two gems required by vcr. After some playing around, I was able to determine that my tests started to fail because the newer version of Tire that I installed seems to connect to the search server when the application boots (that's the
require environment.rb
line in thespec_helper
).My
spec_helper
used to look like this:Now, I have to set it like this to avoid the error:
I know this isn't a tire-specific problem, but I thought it was worth mentioning. It took me a while to find (I should read errors more closely), but you may want to put a notice in the README or some automatic detection or something.
The text was updated successfully, but these errors were encountered: