Skip to content

Commit

Permalink
Work around Action View deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Oct 8, 2019
1 parent 5d4014c commit c897e3d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions spec/view_helpers/action_view_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
get 'ibocorp(/:page)' => 'ibocorp#index',
:constraints => { :page => /\d+/ }, :defaults => { :page => 1 }

get ':controller(/:action(/:id(.:format)))'
get 'foo/bar' => 'foo#bar'
get 'baz/list' => 'baz#list'
end

describe WillPaginate::ActionView do
Expand All @@ -38,7 +39,14 @@
attr_reader :assigns, :controller, :request

def render(locals)
@view = ActionView::Base.new([], @assigns, @controller)
lookup_context = []
if defined? ActionView::LookupContext
lookup_context = ActionView::LookupContext.new(lookup_context)
end

klass = ActionView::Base
klass = klass.with_empty_template_cache if klass.respond_to?(:with_empty_template_cache)
@view = klass.new(lookup_context, @assigns, @controller)
@view.request = @request
@view.singleton_class.send(:include, @controller._routes.url_helpers)
@view.render(:inline => @template, :locals => locals)
Expand Down

0 comments on commit c897e3d

Please sign in to comment.