chrisk / fakeweb

Ruby test helper for injecting fake responses to web requests
MIT License
1.09k stars 134 forks source link

I want to allow some URIs to not be faked #4

Closed halorgium closed 14 years ago

halorgium commented 15 years ago

I like to have a failsafe setup where net_connects are disallowed by default. I've implemented a method for specifying some URIs which are whitelisted.

Please let me know if I need more test coverage, or if the implementation could be more obvious.

The branch "passthrough" is on my fork. halorgium@15f5eb28ec3a67f4887ba7a7606ad2333d8e7017

chrisk commented 15 years ago

Howdy Tim, cool change (nice tests!).

I'm wondering, what's your use case for this? Are you hitting an HTTP service that you consider to be part of the System Under Test, like a CouchDB instance or something?

Thanks, Chris

CodeMonkeySteve commented 14 years ago

BTW, I'm also looking for the same feature (thanks halorgium). In my case I am hitting a CouchDB instance, although I could see user other local services well.

halorgium commented 14 years ago

I am accessing S3 directly. Instead of mocking this part, I whitelist it and to a full HTTP integration.

brycethornton commented 14 years ago

I would like to see this functionality added in order to use webrat/selenium with fakeweb. I currently get this error:

FakeWeb::NetConnectNotAllowedError: Real HTTP connections are disabled. Unregistered request: POST http://localhost:4444/selenium-server/driver/

duien commented 14 years ago

I would love to see this implemented as well, for much the same reason as brycethornton. I've looked at halorgium's implementation as well as another from empact which is based on a more recent version of fakeweb. I like the look of halorgium's much better since it creates its own vocabulary instead of overloading existing terms.

freerobby commented 14 years ago

I'm having the same issue as Bryce. Not being able to allow local requests through is a dealbreaker for using FakeWeb + Selenium.

rbxbx commented 14 years ago

I'd like to re-raise this issue. The patch provides exactly the functionality needed for selenium integration, it'd be silly to fork fakeweb and write it again just to send a pull request ;) (also, I don't particularly want to vendor the gem)

ldenman commented 14 years ago

+1 for this patch. My case is for cucumber/capybara.

anagri commented 14 years ago

+1, I have fakeweb to check my tests are not dependent on any external system. but i have few javascript tests which runs with culerity, which calls localhost, and obviously are caught nicely by fakeweb.

If i have a whitelist of websites, i can include it in setup and run my integration test without hassle.

please update the status of this feature.

rubiii commented 14 years ago

+1 (actually it's +4 cause our team depends on this :) we're using capybara and need to mock all soap requests. unfortunately capybara starts it's own little rack app upfront to check if it can start a server (or something). so we would need to allow that request!

dpmcnevin commented 14 years ago

Another vote for this because of cucumber with capybara

donaldpiret commented 14 years ago

Vote here too for the same reason above

anagri commented 14 years ago

+1

chrisk commented 14 years ago

This is fixed in 1.3.0! Thanks for your patience. See "Allowing requests to a specific server" in the README.