2
2
require 'shared/versioning_examples'
3
3
4
4
describe Grape ::API do
5
- subject ( :a_remountable_api ) { Class . new ( Grape ::API ) }
5
+ subject ( :a_remounted_api ) { Class . new ( Grape ::API ) }
6
6
let ( :root_api ) { Class . new ( Grape ::API ) }
7
7
8
8
def app
9
9
root_api
10
10
end
11
11
12
- describe 'mounted RemountableAPI ' do
12
+ describe 'remounting an API ' do
13
13
context 'with a defined route' do
14
14
before do
15
- a_remountable_api . get '/votes' do
15
+ a_remounted_api . get '/votes' do
16
16
'10 votes'
17
17
end
18
18
end
19
19
20
20
context 'when mounting one instance' do
21
21
before do
22
- root_api . mount a_remountable_api
22
+ root_api . mount a_remounted_api
23
23
end
24
24
25
25
it 'can access the endpoint' do
@@ -30,8 +30,8 @@ def app
30
30
31
31
context 'when mounting twice' do
32
32
before do
33
- root_api . mount a_remountable_api => '/posts'
34
- root_api . mount a_remountable_api => '/comments'
33
+ root_api . mount a_remounted_api => '/posts'
34
+ root_api . mount a_remounted_api => '/comments'
35
35
end
36
36
37
37
it 'can access the votes in both places' do
@@ -44,7 +44,7 @@ def app
44
44
45
45
context 'when mounting on namespace' do
46
46
before do
47
- stub_const ( 'StaticRefToAPI' , a_remountable_api )
47
+ stub_const ( 'StaticRefToAPI' , a_remounted_api )
48
48
root_api . namespace 'posts' do
49
49
mount StaticRefToAPI
50
50
end
@@ -65,13 +65,13 @@ def app
65
65
66
66
context 'with a dynamically configured route' do
67
67
before do
68
- a_remountable_api . namespace 'api' do
68
+ a_remounted_api . namespace 'api' do
69
69
get "/#{ configuration [ :path ] } " do
70
70
'10 votes'
71
71
end
72
72
end
73
- root_api . mount a_remountable_api , with : { path : 'votes' }
74
- root_api . mount a_remountable_api , with : { path : 'scores' }
73
+ root_api . mount a_remounted_api , with : { path : 'votes' }
74
+ root_api . mount a_remounted_api , with : { path : 'scores' }
75
75
end
76
76
77
77
it 'will use the dynamic configuration on all routes' do
0 commit comments