File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ module V1
11
11
SingerRepresenter = Class . new
12
12
BassistRepresenter = Class . new
13
13
SingersRepresenter = Class . new
14
+
15
+ module Inner
16
+ SingerRepresenter = Class . new
17
+ end
14
18
end
15
19
16
20
module V2
@@ -19,6 +23,15 @@ module V2
19
23
SingersRepresenter = Class . new
20
24
end
21
25
26
+ module Inner
27
+ Singer = Class . new
28
+ end
29
+
30
+ module Outer
31
+ Singer = Class . new
32
+ SingerRepresenter = Class . new
33
+ end
34
+
22
35
Bassist = Class . new
23
36
24
37
class FormatsTest < MiniTest ::Spec
@@ -106,6 +119,18 @@ class FormatsTest < MiniTest::Spec
106
119
it 'finds the right class in another namespace' do
107
120
subject . for ( :json , V2 ::Singer . new , 'v1/singers' ) . must_equal V2 ::SingerRepresenter
108
121
end
122
+
123
+ it 'finds the right class in an inner namespace' do
124
+ subject . for ( :json , Inner ::Singer . new , 'v1/singers' ) . must_equal V1 ::Inner ::SingerRepresenter
125
+ end
126
+
127
+ it 'finds the right class from the root namespace' do
128
+ subject . for ( :json , Outer ::Singer . new , 'v1/singers' ) . must_equal Outer ::SingerRepresenter
129
+ end
130
+
131
+ it 'finds the right class in a deep namespace' do
132
+ subject . for ( :json , Singer . new , 'v1/inner/singers' ) . must_equal V1 ::Inner ::SingerRepresenter
133
+ end
109
134
end
110
135
end
111
136
You can’t perform that action at this time.
0 commit comments