'mock' is deprecated after rspec-mock 2.14.0.rc1(2013-05-27 released).
'mock' method may be removed for rspec-mock 3.0.0.
And, this fixes can remove following warnings.
DEPRECATION: mock is deprecated. Use double instead. Called from ...
(cherry picked from commit c0fd016dc3)
Conflicts:
spec/request_spec.rb
RestClient::Exception subclasses RuntimeError, which is a subclass of Exception. According to the Ruby documentation (http://www.ruby-doc.org/ruby-1.9/classes/Exception.html#M000100), the +message+ method is expected to return a string. Before this commit, RestClient::Exception#message would return nil if a message was not set.
This presents a problem for any code that rescues a RestClient::Exception and expects a string in the +message+.
For example:
begin
raise RestClient::Exception
rescue Exception => e
puts e.message + "\n" + "More information"
end
Or, for example, the real life code that uncovered this in production: a0d6cdb263/lib/delayed/job.rb (L72)
This fix makes RestClient::Exceptions better citizens of the Ruby ecosystem. :)