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.