You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue is happening due to the fact that RSpec example groups are classes, and it has to create instances of them--during which Ruby calls the initialize method--in order to run them. In RSpec 3.0.0, RSpec did not define def initialize, and so ExampleGroup.new did not take any arguments, and it did not result in an error. However, your example still did not work properly on RSpec 3.0.0--it's just that it didn't fail loudly. Because your let defines a method, on RSpec 3.0, ExampleGroup.new caused your initialize to get run, meaning it got run eagerly when let is documented as being lazy.
All that's to say: given the special status of initialize in Ruby, I don't think we can support let(:initialize). If you rename it to something else, it'll work.
Hi, I think this issue is simular to this #1163
When using
subject(:initialize)
, rspec-core raises an errorArgumentError: wrong number of arguments (1 for 0)
I used this spec to simulate it:
and run:
the error I received:
I know it is weird to create a
subject(:initialize)
, but I found this problem in a legacy system, when I tried to upgrade rspec from 3.0.0 to 3.5.0!The text was updated successfully, but these errors were encountered: