ruby - Rspec: Is there a problem with rspec-rails when initializing a controller class with super(args)? -
I am using RS for a while and for some reason a controller named Reference Controller is getting errors .
The error says that I must specify the name of the administrator either by using it:
MyController do
or
Describe 'aoeuoeu' to Controller_name: My
I have tried both variations:
Describe the references
and
describe the 'refs controller' Controller_name: Reference
but I have an error for both of them Meets! What could be wrong with any idea?
Burn
Edit : Due to the nature of the solution, I've changed the title again and the relevant code. Here's the wrong code:
# reference-controller.rb
class reference editor & lt;
and error:
1) 'Reference Controller GET Index should take the criteria for a company and return the references' Feldial controller glasses should know how the controller is being specified, you can tell that to the controller () to describe: Describe the MyController or the description of the name of the controller "a mac controller" Do, Controller_name: My # Invoke MacCrol End
If you call super (args)
So, you are going through the same logic - Arg
. By using super (* args)
- the array changes in a list and passes through each element of the args
as a personal argument
As Wayne has pointed out, Ruby also has a small syntax that is called simply super
and it automatically passes on the argument for you, like treating it < Super (* Args) instead of code> super () .
In your special case, I suppose that your controller's initialize
method of superclass does not accept an array, so when RSPEC tried to instantize its controller It failed, resulting in you getting an error message.
Comments
Post a Comment