title: test returning value of a method in rspec
body: <p>Let's say I have a dummy presenter class for my dummy model like this:</p>
  
  <pre><code>class DummyPresenter
    def initialize(dummy_id)
      @dummy = DummyModel.find(dummy_id)
    end
  
    def id
      @dummy.id
    end
  
    def change_child_dummy_name(child_dummy_id, new_child_dummy_name)
      child_dummy = @dummy.child_dummies.find(child_dummy_id)
      child_dummy.update_attributes(:display_name =&gt; new_child_dummy_name)
      child_dummy # I need to return a child_dummy object here!!
    end
  end
  </code></pre>
  
  <p>In my spec:</p>
  
  <pre><code>require 'spec_helper'
  
  describe DummyPresenter do
    before :all do
      @dummy_presenter = DummyPresenter.new(1)
      @child_dummy = DummyModel.find(1).child_dummies.first
    end
  
    it 'should update the display name of a child dummy for a dummy' do
      expect(@child_dummy.display_name).to be_nil
  
      @dummy_presenter.change_child_dummy_name(@child_dummy.id, 'Child Dummy network')
      @child_dummy.reload
      expect(@child_dummy.display_name).to eq('Child Dummy network')
    end
  
    it 'should return updated child dummy' do
      child_dummy_id = @child_dummy.id
      @dummy_presenter.should_receive(:change_child_dummy_name).at_least(:once).with(child_dummy_id, 'Child Dummy network').and_return(@child_dummy)
      @dummy_presenter.change_child_dummy_name(child_dummy_id, 'Child Dummy network')
    end
  end
  </code></pre>
  
  <p>Above test cases pass without any issue.</p>
  
  <p>Now, as per my understanding the first <code>it</code> block works perfectly fine where I just see the updated attribute. But, the second block where I expect the method: <code>change_child_dummy_name</code> to return <code>@child_dummy</code> doesn't work or maybe I didn't understand the code I've written here properly. Because, when I change <code>change_child_dummy_name</code> method inside presenter to this:</p>
  
  <pre><code>def change_child_dummy_name(child_dummy_id, new_child_dummy_name)
    child_dummy = @dummy.child_dummies.find(child_dummy_id)
    child_dummy.update_attributes(:display_name =&gt; new_child_dummy_name)
    "child_dummy" # A String!! Where as I need to return a child_dummy object here!!
  end
  </code></pre>
  
  <p>The specs again pass without raising any error. So, what am I doing wrong?</p>