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
From what I understood of the original project, rspec mocking commands should be supported. I have tried to use allow_any_instance_of(Class).to receive(:check).and_return([]) as the only command in the basic scenario file (of the provided examples). However, my Rails returns an error when I try to execute this. Do you have any clue how I can get this to work?
Text from the original project:
In the scenario you also have access to RSpec mocking functions. So you could do something like:
scenario :basic do
allow(ExternalService).to receive(:retrieve).and_return("result")
end
Thanks a lot!
Update:
By adding the following code, I managed to get it to work! However, I am curious if there's a better way. Also, is there a way to clean up my spec changes for when I don't want to mock anymore? Any idea's?
yes, the original it was part of the project but in order to make it more flexible, I removed more of the built-in functionality in favour of more simple ruby files that are simply called which allows you to do more customisations.
The ruby files that are generated are really only examples, so feel free to modify/add/delete to fit your need.
A word of caution, whatever you require/modify will stay in the running process and could have unexpected side effects. ie RSpec was not built with the idea of it renaming in a running process
That said, I'll look into using your code to add another example file to the cypress-on-rails generator
Hello,
From what I understood of the original project, rspec mocking commands should be supported. I have tried to use
allow_any_instance_of(Class).to receive(:check).and_return([])
as the only command in the basic scenario file (of the provided examples). However, my Rails returns an error when I try to execute this. Do you have any clue how I can get this to work?Text from the original project:
Thanks a lot!
Update:
By adding the following code, I managed to get it to work! However, I am curious if there's a better way. Also, is there a way to clean up my spec changes for when I don't want to mock anymore? Any idea's?
The text was updated successfully, but these errors were encountered: