-
Notifications
You must be signed in to change notification settings - Fork 3
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
Cannot seem to test when new is called #32
Comments
Since mock TestFoo::TestClass do
stub self.new
end But... looks like when I implemented the fix for stubbing |
Should be resolved in v0.9.40, can you verify? Needs to be mocked by using |
Now I'm curious how one would stub |
Also having trouble stubbing mock File do
stub self.file?, path : String, return_type: Bool
end
before_each do
expect(File).to receive(:file?).with("/etc/fedora-release").and_return(true)
end
it { expect(subject.linux_distro).to be(CommandKit::OS::Linux::LinuxDistro::Fedora) }
I think that error message is slightly misleading, since I'm not expecting the |
The error is misleading, I think it's hard-coded to prefix stubbed method names with Can you try this code with latest |
This functionality has been verified to work in the overhauled mock system. See the spec related to this issue for its implementation. This is coming in v0.11 and is currently available on master for testing. Note that this uses |
This issue should be resolved in v0.11. There is a spec dedicated to it. If your issue isn't resolved, please reopen this issue. |
Ran into this when porting RSpec tests which stubs the
new
method so that the tests control the instance object that's returned.The text was updated successfully, but these errors were encountered: