Skip to content

Halve the time it takes to run view specs by enabling the resolver cache #1452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lib/rspec/rails/example/view_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _default_render_options

render_options = { :template => template }
render_options[:handlers] = [handler] if handler
render_options[:formats] = [format] if format
render_options[:formats] = [format.to_sym] if format
render_options[:locales] = [locale] if locale

render_options
Expand Down Expand Up @@ -155,9 +155,6 @@ def _include_controller_helpers
view.lookup_context.prefixes << _controller_path
end

# fixes bug with differing formats
view.lookup_context.view_paths.each(&:clear_cache)

controller.controller_path = _controller_path
controller.request.path_parameters[:controller] = _controller_path
controller.request.path_parameters[:action] = _inferred_action unless _inferred_action =~ /^_/
Expand Down
2 changes: 1 addition & 1 deletion spec/rspec/rails/example/view_example_group_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _assigns
view_spec.render

if ::Rails::VERSION::STRING >= '3.2'
expect(view_spec.received.first).to eq([{:template => "widgets/new", :locales=>['en'], :formats=>['html'], :handlers=>['erb']}, {}, nil])
expect(view_spec.received.first).to eq([{:template => "widgets/new", :locales=>['en'], :formats=>[:html], :handlers=>['erb']}, {}, nil])
else
expect(view_spec.received.first).to eq([{:template => "widgets/new.en.html.erb"}, {}, nil])
end
Expand Down