Guest User

Untitled

a guest
Dec 10th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. their_site = 'http://rest.example.com'
  2. stub_request(:any, /#{their_site}.*/ ).to_raise(Errno::ECONNREFUSED)
  3.  
  4. their_site = 'https://rest.example.com:443/api'
  5. stub_request(:any, %r[#{their_site}.*] ).to_timeout
  6.  
  7. stub_request(:any, %r[#{their_site}.*] )
  8. .to_return(status: 500, body: 'Sorry, mate.')
  9.  
  10. stub_request(:any, %r[#{their_site}.*] )
  11. .to_return(status: 404)
  12.  
  13. stub_request(:any, %r[#{their_site}.*] )
  14. .to_return(status: 200, 'We tried our best.')
  15.  
  16. stub_request(:any, /.*/ ).to_timeout
Add Comment
Please, Sign In to add comment