-
Notifications
You must be signed in to change notification settings - Fork 556
Raising errors
Olia Kremmyda edited this page Mar 24, 2018
·
1 revision
Exception declared by class
stub_request(:any, 'www.example.net').to_raise(StandardError)
RestClient.post('www.example.net', 'abc') # ===> StandardError
or by exception instance
stub_request(:any, 'www.example.net').to_raise(StandardError.new("some error"))
or by string
stub_request(:any, 'www.example.net').to_raise("some error")
Raising timeout errors
stub_request(:any, 'www.example.net').to_timeout
RestClient.post('www.example.net', 'abc') # ===> RestClient::RequestTimeout