Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove stubs from LogSubscriber tests

We can use another way to instantiate ActionView::Base, by passing
renderer as a first option. Thanks to that we can just pass prefixes to
LookupContext instead stubbing them on the controller. This is also good,
because that kind of API is used in Rails code.
  • Loading branch information...
commit 731bb2fe6815ac6a1888d9fb54bb1782e4768c0b 1 parent ba83aa7
@drogus drogus authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 actionpack/test/template/log_subscriber_test.rb
View
7 actionpack/test/template/log_subscriber_test.rb
@@ -8,9 +8,10 @@ class AVLogSubscriberTest < ActiveSupport::TestCase
def setup
super
- @controller = Object.new
- @controller.stubs(:_prefixes).returns(%w(test))
- @view = ActionView::Base.new(ActionController::Base.view_paths, {}, @controller)
+ view_paths = ActionController::Base.view_paths
+ lookup_context = ActionView::LookupContext.new(view_paths, {}, ["test"])
+ renderer = ActionView::Renderer.new(lookup_context)
+ @view = ActionView::Base.new(renderer, {})
Rails.stubs(:root).returns(File.expand_path(FIXTURE_LOAD_PATH))
ActionView::LogSubscriber.attach_to :action_view
end
Please sign in to comment.
Something went wrong with that request. Please try again.