|
10 | 10 |
|
11 | 11 | =end |
12 | 12 |
|
13 | | -require 'spec_helper' |
14 | | - |
15 | 13 | describe Patch::ApiClient do |
16 | 14 | context 'initialization' do |
17 | | - context 'URL stuff' do |
18 | | - context 'host' do |
19 | | - it 'removes http from host' do |
20 | | - Patch.configure { |c| c.host = 'http://example.com' } |
21 | | - expect(Patch::Configuration.default.host).to eq('example.com') |
22 | | - end |
23 | | - |
24 | | - it 'removes https from host' do |
25 | | - Patch.configure { |c| c.host = 'https://wookiee.com' } |
26 | | - expect(Patch::ApiClient.default.config.host).to eq('wookiee.com') |
27 | | - end |
28 | | - |
29 | | - it 'removes trailing path from host' do |
30 | | - Patch.configure { |c| c.host = 'hobo.com/v4' } |
31 | | - expect(Patch::Configuration.default.host).to eq('hobo.com') |
32 | | - end |
| 15 | + context 'base_path' do |
| 16 | + it "prepends a slash to base_path" do |
| 17 | + Patch.configure { |c| c.base_path = 'v4/dog' } |
| 18 | + expect(Patch::Configuration.default.base_path).to eq('/v4/dog') |
| 19 | + end |
| 20 | + |
| 21 | + it "doesn't prepend a slash if one is already there" do |
| 22 | + Patch.configure { |c| c.base_path = '/v4/dog' } |
| 23 | + expect(Patch::Configuration.default.base_path).to eq('/v4/dog') |
33 | 24 | end |
34 | 25 |
|
35 | | - context 'base_path' do |
36 | | - it "prepends a slash to base_path" do |
37 | | - Patch.configure { |c| c.base_path = 'v4/dog' } |
38 | | - expect(Patch::Configuration.default.base_path).to eq('/v4/dog') |
39 | | - end |
40 | | - |
41 | | - it "doesn't prepend a slash if one is already there" do |
42 | | - Patch.configure { |c| c.base_path = '/v4/dog' } |
43 | | - expect(Patch::Configuration.default.base_path).to eq('/v4/dog') |
44 | | - end |
45 | | - |
46 | | - it "ends up as a blank string if nil" do |
47 | | - Patch.configure { |c| c.base_path = nil } |
48 | | - expect(Patch::Configuration.default.base_path).to eq('') |
49 | | - end |
| 26 | + it "ends up as a blank string if nil" do |
| 27 | + Patch.configure { |c| c.base_path = nil } |
| 28 | + expect(Patch::Configuration.default.base_path).to eq('') |
50 | 29 | end |
51 | 30 | end |
52 | 31 | end |
|
0 commit comments