title: Fetching 'action_name' or 'controller' from helper spec
body: <p>Let's say that I have the following code in <strong>application_helper.rb</strong>:</p>
  
  <pre><code>def do_something
   if action_name == 'index'
     'do'
   else
     'dont'
   end
  end
  </code></pre>
  
  <p>which will do something if called within index action. </p>
  
  <p>Q: How do I rewrite the helper spec for this in <strong>application_helper_spec.rb</strong> to simulate a call from 'index' action?</p>
  
  <pre><code>describe 'when called from "index" action' do
    it 'should do' do
      helper.do_something.should == 'do' # will always return 'dont'
    end
  end
  
  describe 'when called from "other" action' do
    it 'should do' do
      helper.do_something.should == 'dont'
    end
  end
  </code></pre>