0
正則表達式如何被存根? 例如rspec中的存根正則表達式
# somewhere deep in the code
reg = Regexp.new("foo bar")
res = reg.match string
# somewhere in rspec
reg = Regexp.new("foo bar")
reg.stub(:match).with(string).and_return "rspec_res" #doesn't work
事實上它應該(:將盡快接受 – ted 2012-08-02 15:22:19