Make KernelSystemCall more specific

Test that calls to`system` on modules other than `Kernel` are excluded,
such as in this example:

    module Foo
      def self.system(*args); end
    end

    # This is not a call to Kernel.system
    Foo.system("bar")
This commit is contained in:
Harry Maclean
2021-09-07 13:26:33 +01:00
parent fb23a2e3bf
commit cbc14ccda9
2 changed files with 36 additions and 18 deletions

View File

@@ -66,4 +66,23 @@ Open3.pipeline("echo foo")
<<`EOF`
echo foo
EOF
EOF
module MockSystem
def system(*args)
args
end
def self.system(*args)
args
end
end
class Foo
include MockSystem
def run
system("ls")
MockSystem.system("ls")
end
end