Created
July 22, 2013 10:42
-
-
Save ianpetzer/6052955 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "mocked query of web service" do | |
it "should perform correct action on system data based on mocked response" do | |
RestClient = double | |
file = File.open('RELATIVE_FILE_PATH_HERE', 'r') #Relative to root of Rails app | |
data = file.read | |
file.close | |
response = double | |
response.stub(:code) { 200 } | |
response.stub(:body) { data } | |
response.stub(:headers) { {} } | |
RestClient.stub(:get) { response } | |
YourApp.call_method_that_results_in_web_service_query | |
#Your assertions here | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment