Skip to content

Instantly share code, notes, and snippets.

@ericchen
Created May 27, 2011 09:02
Show Gist options
  • Save ericchen/994892 to your computer and use it in GitHub Desktop.
Save ericchen/994892 to your computer and use it in GitHub Desktop.
mock http test
mock_http = mock("http")
Net::HTTP.stub!(:new).with('www.google.com', 443).and_return(mock_http)
mock_http.should_receive(:use_ssl=).with(true)
mock_http.stub!(:start).and_yield mock_http
mock_http.stub!(:request).and_return 3
get :rate_password, :password => '12345678'
response.should be_success
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment