This question shows research effort; it is useful and clear
0
This question does not show any research effort; it is unclear or not useful
Bookmark this question.
Show activity on this post.
如何对正则表达式进行存根?例如
# 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