Rspec how to stub module instance method?
<p>B.rb looks like:</p>

<pre><code>module A
   module B

     def enabled? xxx
        xxx == 'a'
     end

     def disabled? xxx
       xxx != 'a'
     end
   end
end
</code></pre>

<p>Another C.rb like:</p>

<pre><code>module YYY
  class C
  include A::B

  def a_method 
     if(enabled? xxx) 
       return 'a'
     return 'b'
  end
end
</code></pre>

<p>Now I want to write unit tests to test a_method function, </p>

<pre><code> describe :a_method do
    it 'returns a' do
       ###how to sub enabled? method to make it return true....
    end
 end 
</code></pre>

<p>enabled? is the instance method in the model, I tried </p>

<pre><code>A::B.stub.any_instance(:enabled).and_return true
</code></pre>

<p>it doesn't work.</p>

<p>anyone can help me????</p>