# Testing with external web services

**URL:** <https://www.ruby-forum.com/t/testing-with-external-web-services/128221>\
**Category:** Rails\
**Created:** [February 5, 2008, 11:43pm UTC](https://www.ruby-forum.com/t/testing-with-external-web-services/128221 "2008-02-05T23:43:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gawk007](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/97f17d/32.png) [@gawk007](https://www.ruby-forum.com/u/gawk007)\
**Post date:** [February 5, 2008, 11:43pm UTC](https://www.ruby-forum.com/t/testing-with-external-web-services/128221/1 "2008-02-05T23:43:52Z")

</div>

I’m working on a new Rails project that has to integrate with an  
existing legacy billing system. The integration involves a read only  
web service to check authentication for the new site.

What I need to check is if the web service can or cannot be contacted,  
as different bits of code are run depending on whether the connection  
can be made or not. Basically, if a connection cannot be made to the  
web service, the Rails app will fall back and use a table in the  
project database rather than the data from the web service.

I need to test both conditions, but as is, I can either contact the  
web service or I can’t, so I’m only testing one of the two conditions.

I’m aware of flexmock, but not sure if it’s what need to look at.

That’s a bit abbreviated, but I hope is enough to go on…

Thanks,
