title: How can I mock an instance variable in rspec
body: <p>I have two class <code>OneClass</code> and <code>AnotherClass</code>:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I am getting to write unit for <code>OneClass</code>. 
  How can I mock <code>@another_member</code>?</p>