-
Notifications
You must be signed in to change notification settings - Fork 274
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
Rails 6 error thrown in render - wrong number of arguments (given 2, expected 1) #204
Comments
Hi! I checked the issue, and it seems like the problem is not in meta-tags, but in RSpec. First of all, in Ruby you can pass a block to any method without consequences: def a
puts "Hello"
end
a { raise "Really?" }
# → Hello Now, for your issue, if you turn on a backtrace in RSpec (
So, ActionView calls a handler with two arguments (link): def compile(mod)
source = encode!
code = @handler.call(self, source) While RSpec overrides it with one argument (link): class EmptyTemplateHandler
def self.call(_template)
::Rails.logger.info(" Template rendering was prevented by rspec-rails. Use `render_views` to verify rendered view contents if necessary.")
%("")
end
end This was already reported and fixed in RSpec 4.dev: |
You're totally right. Switching to that branch worked. Really appreciate your quick reply on this. |
You're welcome :-) |
Hello! I just updated to Rails 6 and have the latest version of the gem (2.12.0).
I'm experiencing an error in one of my rspec tests in which it looks the controller render method is passing the wrong number of arguments.
The test is very simple
I believe the offending method is in ControllerHelper in the render method
I believe super is passing both args and block to the render method but the super render method is only expecting one argument. As a proof of concept I modified the call to be super(args) and that seemed to work. Not really sure if this is the solution though.
The text was updated successfully, but these errors were encountered: