Skip to content

Commit 1188f7c

Browse files
zettersebjacobs
authored andcommitted
Speed up view specs by re-enabling resolver cache
The caching was turned off in [1] because different formats were being cached under the same key. I believe the need to do this was removed in the previous commit. This reduces the time it takes to run FutureLearn’s view specs by 50%. I think it’s sensible to use the view resolver cache during tests because it’s normally on between requests in other environments including when creating tests with `ActionView::TestCase` in a new Rails application. It looks like it was only turned off in rspec-rails to work around this caching issue. I haven't added any test coverage in this change since it feels like it would be testing a negative (the resolver cache isn't cleared). [1] rspec#864
1 parent 4cfdfe9 commit 1188f7c

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

lib/rspec/rails/example/view_example_group.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,6 @@ def _include_controller_helpers
155155
view.lookup_context.prefixes << _controller_path
156156
end
157157

158-
# fixes bug with differing formats
159-
view.lookup_context.view_paths.each(&:clear_cache)
160-
161158
controller.controller_path = _controller_path
162159
controller.request.path_parameters[:controller] = _controller_path
163160
controller.request.path_parameters[:action] = _inferred_action unless _inferred_action =~ /^_/

0 commit comments

Comments
 (0)