I use geocoding in our app, and it permeates most of the core functionality. Because it makes a call out to Google or Yahoo or what not to do the geocoding, I'd like to mock this for the bulk of my tests, except for the few tests that actually do stuff where they need the real data. I had started wrapping all my specs with the equivalent (but a DRY form) of: GeoInfo = Struct.new(:lat, :lng, :success) describe "with fake geocoding" do before(:all) do fake_geocode = GeoInfo.new(123.456, 789.012, true)
GeoKit::Geocoders::MultiGeocoder.stub!(:geocode).and_return(fake_geocode) end # bulk of tests are here end describe ... #other tests that want real geocoding here But, that just seems like a poor way to do it. I'm wondering, how can I make GeoKit::Geocoders::MultiGeocoder fake by default, and then in the few cases where I want it to be real, "un-stub" it or whatever you'd call it? -- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users