title: Rspec testing instance method which require other methods return (stubbing?)
body: <p>I want those already methods to be tested, but everything I try, doesn't seem to fit with best practices nor do it work.</p>
  
  <p>May be somebody can support me with this?</p>
  
  <p>CODE To be tested</p>
  
  <pre><code>def any_subset_greater?
    divisors_sums.any?{|sum| sum &gt; @value}
  end
  
  def no_subset_equal?
    !divisors_sums.any?{|sum| sum == @value}
  end
  
  def check_room
    any_subset_greater? &amp;&amp; no_subset_equal?
  end
  </code></pre>
  
  <p>RSPEC TRY </p>
  
  <p>first specify seems not to set proper return values for the divisors method and the instance variable @value.</p>
  
  <pre><code>describe "#any_subset_greater?" do
    # Examples:
    # [1,2] &gt; 4   #=&gt; false
    # [1,2,3] &gt; 4 #=&gt; true
    specify "returns true, when value in the array is greater" do
      number.stub(:divisors){[1,2,3]}
      number.stub(:value) {4}
      expect(number.any_subset_greater?).to be_true
    end
  
  end
  
  describe "#no_subset_equal?" do
    # Examples:
    # 4 === [1,2,4]   #=&gt; false
    # 4 === [1,2,3]   #=&gt; false
    # 4 === [1,2,6]   #=&gt; true
  end
  
  describe "#check_room" do
    # testing condition from methods above
  end
  </code></pre>