的實例變量我有兩個類OneClass
和AnotherClass
:我如何可以模擬在rspec的
class OneClass
def initialize(*args)
@another_member = AnotherClass.new()
end
def my_method()
if @another_member.another_method1() then
@another_member.another_method2()
end
@another_member.another_method3()
end
end
我正在寫單位OneClass
。 我該如何模擬@another_member
?