File tree 2 files changed +37
-1
lines changed
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ def _path_decorator(*paths)
137
137
before do
138
138
unless render_views?
139
139
@_original_path_set = controller . class . view_paths
140
- path_set = @_original_path_set . map { |resolver | RESOLVER_CACHE [ resolver . to_s ] }
140
+ path_set = @_original_path_set . map { |resolver | RESOLVER_CACHE [ resolver ] }
141
141
142
142
controller . class . view_paths = path_set
143
143
controller . extend ( EmptyTemplates )
Original file line number Diff line number Diff line change @@ -146,6 +146,42 @@ def example.controller
146
146
} . to_not raise_error
147
147
end
148
148
149
+ context 'with empty template resolver' do
150
+ class CustomResolver < ActionView ::Resolver
151
+ def custom_method
152
+ true
153
+ end
154
+ end
155
+
156
+ it "works with custom resolvers" do
157
+ custom_method_called = false
158
+ ActionController ::Base . view_paths = ActionView ::PathSet . new ( [ CustomResolver . new ] )
159
+ group . class_exec do
160
+ describe "example" do
161
+ it do
162
+ custom_method_called = ActionController ::Base . view_paths . first . custom_method
163
+ end
164
+ end
165
+ end . run ( double . as_null_object )
166
+
167
+ expect ( custom_method_called ) . to eq ( true )
168
+ end
169
+
170
+ it "works with strings" do
171
+ decorated = false
172
+ ActionController ::Base . view_paths = ActionView ::PathSet . new ( [ 'app/views' , 'app/legacy_views' ] )
173
+ group . class_exec do
174
+ describe "example" do
175
+ it do
176
+ decorated = ActionController ::Base . view_paths . all? { |resolver | resolver . is_a? ( ViewRendering ::EmptyTemplateResolver ::ResolverDecorator ) }
177
+ end
178
+ end
179
+ end . run ( double . as_null_object )
180
+
181
+ expect ( decorated ) . to eq ( true )
182
+ end
183
+ end
184
+
149
185
def match_paths ( *paths )
150
186
eq paths . map { |path | File . expand_path path }
151
187
end
You can’t perform that action at this time.
0 commit comments