Skip to content

Commit

Permalink
Make ResolverDecorator a subclass of ActionView::Resolver
Browse files Browse the repository at this point in the history
Follows
rails/rails@e65d41a.

ActionView::PathSet now rejects resolvers unless they inherit from
ActionView::Resolver, so ResolverDecorator must do so. By removing all
inherited methods, we ensure that method_missing will still intercept
all method calls.

Co-authored-by: Iliana Hadzhiatanasova <me@iliana.dev>
  • Loading branch information
2 people authored and pirj committed Oct 28, 2022
1 parent 948021c commit c2aac54
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/rspec/rails/view_rendering.rb
Expand Up @@ -71,7 +71,15 @@ def self.template_format(template)
# templates with modified source
#
# @private
class ResolverDecorator
class ResolverDecorator < ::ActionView::Resolver
(::ActionView::Resolver.instance_methods - Object.instance_methods).each do |method|
undef_method method
end

(::ActionView::Resolver.methods - Object.methods).each do |method|
singleton_class.undef_method method
end

def initialize(resolver)
@resolver = resolver
end
Expand Down

0 comments on commit c2aac54

Please sign in to comment.