Webmock should block other gem connections #177

zedtux opened this Issue Apr 24, 2012 · 5 comments


None yet

2 participants

zedtux commented Apr 24, 2012


I'm a huge fan of WebMock and I love it!
But today it is not working as expected...

I'm using WebMock (1.8.6) in a Rails (3.2.3) project. In this project I have to deal with RSS Feed.
So I want to mock them.

As I didn't find any gem doing exactly what I was looking for I've start to write my own one: urss.
After publishing it to rubygems.org and installed it in my project, I'm now expecting WebMock to block its connection, but it doesn't.

The current version of urss (0.0.3) use open-uri library. I've think that this could be the issue, so I tried to convert my gem from open-uri to net/http but it still not block it.

Is it possible to make it working and so how ?

Thanks in advance.

@bblimke bblimke closed this May 12, 2012
zedtux commented May 19, 2012

Why did you close my issue?

I still have the issue that webmock don't block the connections of gems.
When I execute the at method of my urss gem, it connects to the URL instead of being blocked.

bblimke commented May 19, 2012

Sorry, I thought this one fixed your problem: zedtux/urss#1

The RSpec 2.10 issue was also fixed in WebMock 1.8.7

Can you provide a sample code/spec to reproduce the problem?

zedtux commented May 19, 2012

Yes, I will push an example of project that will show you my issue soon.

zedtux commented May 20, 2012

This morning, I have started a new Rails project with cucumber and webmock.

Guess what? It works! So I have to investigate more. I've pushed it in order to allow you to have better understanding of my issue, and also because the simple require in Cucumber's env.rb file still not work.

So the repository URL is https://github.com/zedtux/webmock_issue_177 and you should focus on the env.rb file and the feature file (and its step file).

bblimke commented May 20, 2012

ok, so the only thing that doesn't work for you now is webmock/cucumber right?

it does't work because you call stub_request outside Cucumber world. When you
require 'webmock/cucumber' then webmock api is only available inside Cucumber steps or hooks.


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