it "should not hit the web" do
@premise.lookup_things_on_the_web.should_not raise_exception
end
end
----
When I run the test, I see:
just stubbed #<Premise id: 1, user_id: 1, ...>
entering lookup_stuff_on_the_web with #<Premise id: 1, user_id: 1, ...>
Failure/Error: ...
WebMock::NetConnectNotAllowedError:
As far as I can see, the Premise that's being stubbed and the Premise
whose lookup_stuff_on_the_web method is getting called are one and the
same. What I can't figure out is why the stub isn't being honored.
(FWIW, the same setup code is working in other tests.)
Are there any known gotchas I should be looking for? Or specific things
I should try to uncover the cause?
TIA.
- ff
--
Posted via http://www.ruby-forum.com/.
_______________________________________________
rspec-users mailing list
rspec...@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
just stubbed #<Premise:0x000001069b99f0>
entering lookup_stuff_on_the_web with #<Premise:0x00000106b08ec8>
Now my problem is figuring out why/where the other Premise is getting
created.
In other words, move along...nothing to see here. :)
Scott
No, but I think I see what's happening: I'm stubbing a particular
(in-memory) instance of an AR. Later on in my code, the same AR is
fetched, but now has a different in-memory address, and thus isn't
subject to stubbing. (Is my analysis plausible?)
So my new question is: can I stub Premise#lookup_stuff_on_the_web for
all objects? (I could just set up WebMock to return a specific
response, but it's a complex data structure and it would be much cleaner
to stub Premise#lookup_stuff_on_the_web instead.)