class A
def initialize
@x = do_something
end
def do_something
42
end
end
How can I stub do_something
in rspec, before the original implementation is called (thus assigning 42 to @x
)? And without changing the implementation, of course.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…