1
0
Fork 0
mirror of https://github.com/rest-client/rest-client.git synced 2022-11-09 13:49:40 -05:00
Commit graph

7 commits

Author SHA1 Message Date
Andy Brody
4971d1a6e1 Convert specs to RSpec 2.99.2 syntax with Transpec
This conversion is done by Transpec 3.2.2 with the following command:
    transpec

* 317 conversions
    from: obj.should
      to: expect(obj).to

* 160 conversions
    from: obj.stub(:message)
      to: allow(obj).to receive(:message)

* 100 conversions
    from: obj.should_receive(:message)
      to: expect(obj).to receive(:message)

* 30 conversions
    from: lambda { }.should
      to: expect { }.to

* 22 conversions
    from: obj.should_not_receive(:message)
      to: expect(obj).not_to receive(:message)

* 4 conversions
    from: obj.should_not
      to: expect(obj).not_to

* 2 conversions
    from: == expected
      to: eq(expected)

* 1 conversion
    from: expect(collection).to have_at_least(n).items
      to: expect(collection.size).to be >= n

* 1 conversion
    from: obj.unstub(:message)
      to: allow(obj).to receive(:message).and_call_original

For more details: https://github.com/yujinakayama/transpec#supported-conversions
2016-06-05 19:52:16 -04:00
Andy Brody
3e8f445570 Add compatibility tests. 2015-11-11 17:20:48 -08:00
Andy Brody
a5b0998fdc Rework exception classes in various small ways.
- Re-parent RestClient::Exceptions::Timeout under
  RestClient::RequestTimeout. Ideally these would be separate, since
  HTTP 408 is completely unrelated to network timeouts. However, making
  Timeout a subclass of RequestTimeout will preserve backwards
  compatibility while still making it possible to distinguish between
  the cases for users who want to.

- Make all HTTP status exception classes subclasses of
  RestClient::RequestFailed. Previously there were exceptions carved out
  for HTTP 304, 401, and 404, which for some reason directly subclassed
  the parent class of RequestFailed, ExceptionWithResponse. I don't know
  what purpose this served.
2015-09-12 23:50:33 -07:00
Andy Brody
5457e396a0 Rename RestClient::ResourceNotFound to ::NotFound.
The actual HTTP response code is "Not Found", and basically every other
exception matches the RFCs. Preserve ResourceNotFound as an alias for
backwards-compatibility.

Fixes: #265
2015-04-15 17:31:58 -07:00
Andy Brody
4a92558bd2 Drop some 2008-era backwards compatibility.
These constants and methods have been deprecated for 5+ years, and
should no longer be used.
2015-04-15 16:27:48 -07:00
Andy Brody
5ce0c6ebde Fix up tests for encoding changes.
Add a `.to_hash => {}` for the Net HTTP response mocks.
2015-03-13 18:00:51 -07:00
Larry Gilbert
d7a11503af Reorganize specs
* Put unit and integration specs into separate subdirectories
* Consolidate all requires of 'webmock/rspec' into spec_helper.rb
* Use WebMock.{disable!,enable!} for specs calling live server
2013-08-30 18:45:06 -07:00
Renamed from spec/exceptions_spec.rb (Browse further)