如何使用Rspec模拟[]函数?
使用Rspec,我可以模拟如何使用Rspec模拟[]函数?,rspec,Rspec,使用Rspec,我可以模拟Dir.glob(“/my/Dir/*.tmp”)这样做: expect(Dir).to receive(:glob).with("/my/dir/*.tmp") 如何模拟Dir[“/my/Dir/*.tmp”] expect(Dir).to receive(:"[]").with("/my/dir/*.tmp")
Dir.glob(“/my/Dir/*.tmp”)
这样做:
expect(Dir).to receive(:glob).with("/my/dir/*.tmp")
如何模拟Dir[“/my/Dir/*.tmp”]
expect(Dir).to receive(:"[]").with("/my/dir/*.tmp")