Therefore, I want to redefine backlinks in the test file and apply this to all the scripts that are called during testing. The test file uses several classes (stored in other files), and when these classes use backreferences, the override that I have in the test file does not apply.
eg. Below in the test file ( tc_some_test.rb )
module BacktickURI def `(uri) # `untrick beautifier puts "uri = #{uri}\n" if uri =~ /some command/ puts "command ran #{uri}\n" else system("#{uri} 2>&1") end end end include BacktickURI
For all backticks used in tc_some_test.rb , this works, but the outer classes and scripts that invoke still use regular, non-overlapping backlinks.
Any help is appreciated. An alternative would be a way to override methods in one script / file from another script / file.
source share