|
9 | 9 | request.to_raise(HTTP::ConnectionError) |
10 | 10 | end |
11 | 11 |
|
12 | | - it 'raises a ConnectionError' do |
13 | | - expect { client.response }.to raise_error(IndieWeb::Endpoints::ConnectionError) |
| 12 | + it 'raises an HttpError' do |
| 13 | + expect { client.response }.to raise_error(IndieWeb::Endpoints::HttpError) |
14 | 14 | end |
15 | 15 | end |
16 | 16 |
|
|
19 | 19 | request.to_raise(HTTP::TimeoutError) |
20 | 20 | end |
21 | 21 |
|
22 | | - it 'raises a TimeoutError' do |
23 | | - expect { client.response }.to raise_error(IndieWeb::Endpoints::TimeoutError) |
| 22 | + it 'raises an HttpError' do |
| 23 | + expect { client.response }.to raise_error(IndieWeb::Endpoints::HttpError) |
24 | 24 | end |
25 | 25 | end |
26 | 26 |
|
|
29 | 29 | request.to_raise(HTTP::Redirector::TooManyRedirectsError) |
30 | 30 | end |
31 | 31 |
|
32 | | - it 'raises a TooManyRedirectsError' do |
33 | | - expect { client.response }.to raise_error(IndieWeb::Endpoints::TooManyRedirectsError) |
| 32 | + it 'raises an HttpError' do |
| 33 | + expect { client.response }.to raise_error(IndieWeb::Endpoints::HttpError) |
| 34 | + end |
| 35 | + end |
| 36 | + |
| 37 | + context 'when given an invalid URL' do |
| 38 | + let(:url) { 'http:' } |
| 39 | + |
| 40 | + it 'raises an InvalidURIError' do |
| 41 | + expect { client.response }.to raise_error(IndieWeb::Endpoints::InvalidURIError) |
| 42 | + end |
| 43 | + end |
| 44 | + |
| 45 | + context 'when given a relative URL' do |
| 46 | + let(:url) { '../foo/bar/biz/baz' } |
| 47 | + |
| 48 | + it 'raises an HttpError' do |
| 49 | + message = 'unknown scheme: ' |
| 50 | + |
| 51 | + expect { client.response }.to raise_error(IndieWeb::Endpoints::HttpError, message) |
| 52 | + end |
| 53 | + end |
| 54 | + |
| 55 | + context 'when given a URL with an invalid protocol' do |
| 56 | + let(:url) { 'file:///foo/bar/baz' } |
| 57 | + |
| 58 | + it 'raises an HttpError' do |
| 59 | + message = 'unknown scheme: file' |
| 60 | + |
| 61 | + expect { client.response }.to raise_error(IndieWeb::Endpoints::HttpError, message) |
34 | 62 | end |
35 | 63 | end |
36 | 64 | end |
0 commit comments