So I wish to override backticks in a testing file, and have this apply to all scripts that are called during testing. The testing file employs several classes (saved in other files), and when these classes use backticks the override I have in the testing file does not apply.
e.g. The following is in the testing 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 external classes and scripts that are called still use the normal, non-overridden backticks.
Any help is appreciated. An alternative could be a way to override methods in one script/file from a different script/file.