Changes to the Template handler calls in Rails 6.0 beta breaks EmptyTemplateResolver
Specifically this change which changes actionview/lib/action_view/template.rb, line 307, from this...
code = @handler.call(LegacyTemplate.new(self, source))
... to this ...
code = @handler.call(self, source)
... breaks rspec-rails, lib/rspec/rails/view_rendering.rb, line 105
def self.call(_template)
with the following error;
ActionView::Template::Error:
wrong number of arguments (given 2, expected 1)
Ruby version: ruby 2.5.1p57
Rails version: 6.0.0.beta2
Rspec version: 3.8.2
Any PR for this should target 4-0-dev
Hi @JonRowe - targeting 4-0-dev (which currently has some test failures around Notifications) sounds like a good plan - but this patch will need to sniff which version of ActionView it's running against right? Is there a simple example of where that is already being done?
@jamesjefferies Why not be Rails version specific? For example https://github.com/rspec/rspec-rails/blob/8c6c9590b94916199950dc8a91a9741d3be30c7c/lib/rspec-rails.rb#L10
TBH I'm not sure we need to gate this, our method defines one argument, it needs two on this version of Rails, seems like simply adding a second optional argument would fix it, and gate the spec instead.
(Also 馃憢 @jamesjefferies)
@JonRowe ah yes, that sounds like the best way to sort this .. and yes! 馃憢
@JonRowe I toyed with that in a monkey-patch
def self.call(_template, source)
, but given the method doesn't use _template as it is, it seemed a reasonable future-proof solution, Just a thought.
It'd need to be _source = nil in order to remain backwards compatible.
Fixed in #2089
Most helpful comment
It'd need to be
_source = nilin order to remain backwards compatible.