I've got something like this :
class Something
def some_method
%x{xyz}
end
end
在规范中,内容如下:
describe Something do
describe "#some_method" do
it "should execute xyz command in a subshell" do
x = Something.new
#What should come here?
x.some_method
end
end
end
我知道如何模拟 "system"。但我的问题是关于 "%x"。那么如何模拟 %x?